WordPress.org

Make WordPress Core

Changeset 43455


Ignore:
Timestamp:
07/16/2018 01:51:08 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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

Props allendav, desrosj.
Merges [43376] and [43454] to the 4.9 branch.
Fixes #44100.

Location:
branches/4.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/admin-filters.php

    r43231 r43455  
    151151add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
    152152
     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 );
  • branches/4.9/src/wp-admin/includes/misc.php

    r43368 r43455  
    12241224
    12251225/**
     1226 * Appends '(Draft)' to draft page titles in the privacy page dropdown
     1227 * so that unpublished content is obvious.
     1228 *
     1229 * @since 4.9.8
     1230 * @access private
     1231 *
     1232 * @param string  $title Page title.
     1233 * @param WP_Post $page  Page data object.
     1234 *
     1235 * @return string Page title.
     1236 */
     1237function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
     1238    if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
     1239        /* translators: %s: Page Title */
     1240        $title = sprintf( __( '%s (Draft)' ), $title );
     1241    }
     1242
     1243    return $title;
     1244}
     1245
     1246/**
    12261247 * WP_Privacy_Policy_Content class.
    12271248 * TODO: move this to a new file.
Note: See TracChangeset for help on using the changeset viewer.