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

Props allendav, desrosj.
Fixes #44100.

git-svn-id: https://develop.svn.wordpress.org/trunk@43376 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2018-06-19 12:11:46 +00:00
parent 2972f7c220
commit 1ebcb33c3c
2 changed files with 24 additions and 0 deletions

View File

@ -149,3 +149,6 @@ add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_con
// Update the cached policy info when the policy page is 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

@ -1271,6 +1271,27 @@ All at ###SITENAME###
}
}
/**
* Appends '(Draft)' to draft page titles in the privacy page dropdown
* so that unpublished content is obvious.
*
* @since 4.9.7
* @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.
* TODO: move this to a new file.