WordPress.org

Make WordPress Core

Changeset 43376


Ignore:
Timestamp:
06/19/2018 12:11:46 PM (3 years ago)
Author:
azaozz
Message:

Privacy: append (Draft) to draft page titles in the page drop-down on the Privacy Settings screen.

Props allendav, desrosj.
Fixes #44100.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/admin-filters.php

    r43230 r43376  
    150150// Update the cached policy info when the policy page is updated.
    151151add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
     152
     153// Append '(Draft)' to draft page titles in the privacy page dropdown.
     154add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );
  • trunk/src/wp-admin/includes/misc.php

    r43367 r43376  
    12731273
    12741274/**
     1275 * Appends '(Draft)' to draft page titles in the privacy page dropdown
     1276 * so that unpublished content is obvious.
     1277 *
     1278 * @since 4.9.7
     1279 * @access private
     1280 *
     1281 * @param string  $title Page title.
     1282 * @param WP_Post $page  Page data object.
     1283 *
     1284 * @return string Page title.
     1285 */
     1286function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
     1287    if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
     1288        /* translators: %s: Page Title */
     1289        $title = sprintf( __( '%s (Draft)' ), $title );
     1290    }
     1291
     1292    return $title;
     1293}
     1294
     1295/**
    12751296 * WP_Privacy_Policy_Content class.
    12761297 * TODO: move this to a new file.
Note: See TracChangeset for help on using the changeset viewer.