From 7e9be993e6ebfdd2860c86097b96fbdb53475c51 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 28 Jun 2018 02:42:29 +0000 Subject: [PATCH] Privacy: append `(Draft)` to draft page titles in the page drop-down on the Privacy Settings screen. Props allendav, desrosj. Fixes #44100. Built from https://develop.svn.wordpress.org/trunk@43376 git-svn-id: http://core.svn.wordpress.org/trunk@43204 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/admin-filters.php | 3 +++ wp-admin/includes/misc.php | 21 +++++++++++++++++++++ wp-includes/version.php | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 79e30c0eda..bfc9f51cfc 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -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 ); diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 00397dd564..013d0062c1 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index fc4fd0d23b..6f25b4dae4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43375'; +$wp_version = '5.0-alpha-43376'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.