Make WordPress Core

Ticket #44100: 44100.3.diff

File 44100.3.diff, 1.4 KB (added by desrosj, 7 years ago)
  • src/wp-admin/privacy.php

     
    1313        wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
    1414}
    1515
     16/**
     17 * Appends '(Draft)' to draft page titles in the privacy page dropdown
     18 * so that unpublished content is obvious.
     19 *
     20 * @since 4.9.7
     21 * @access private
     22 *
     23 * @param string  $title Page title.
     24 * @param WP_Post $page  Page data object.
     25 *
     26 * @return string Page title.
     27 */
     28function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
     29        if ( 'draft' === $page->post_status ) {
     30                /* translators: %s: Page Title */
     31                $title = sprintf( __( '%s (Draft)' ), $title );
     32        }
     33
     34        return $title;
     35}
     36
    1637$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
    1738
    1839if ( ! empty( $action ) ) {
     
    211232                                                </label>
    212233                                                <input type="hidden" name="action" value="set-privacy-page" />
    213234                                                <?php
     235                                                add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );
    214236                                                wp_dropdown_pages(
    215237                                                        array(
    216238                                                                'name'              => 'page_for_privacy_policy',
     
    220242                                                                'post_status'       => array( 'draft', 'publish' ),
    221243                                                        )
    222244                                                );
     245                                                remove_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );
    223246
    224247                                                wp_nonce_field( 'set-privacy-page' );
    225248