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.
Built from https://develop.svn.wordpress.org/branches/4.9@43455


git-svn-id: http://core.svn.wordpress.org/branches/4.9@43282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-07-16 13:52:26 +00:00
parent 8040b247a4
commit 30b402c24b
3 changed files with 24 additions and 1 deletions

View File

@ -150,3 +150,5 @@ add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_con
// Update the cached policy info when the policy page is updated. // Update the cached policy info when the policy page is updated.
add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) ); add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
// Append '(Draft)' to draft page titles in the privacy page dropdown.
add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );

View File

@ -1222,6 +1222,27 @@ All at ###SITENAME###
} }
} }
/**
* Appends '(Draft)' to draft page titles in the privacy page dropdown
* so that unpublished content is obvious.
*
* @since 4.9.8
* @access private
*
* @param string $title Page title.
* @param WP_Post $page Page data object.
*
* @return string Page title.
*/
function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
/* translators: %s: Page Title */
$title = sprintf( __( '%s (Draft)' ), $title );
}
return $title;
}
/** /**
* WP_Privacy_Policy_Content class. * WP_Privacy_Policy_Content class.
* TODO: move this to a new file. * TODO: move this to a new file.

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9.8-alpha-43453'; $wp_version = '4.9.8-alpha-43455';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.