Make WordPress Core

Ticket #48431: 48431.1.diff

File 48431.1.diff, 2.5 KB (added by chetan200891, 6 years ago)

Updated patch.

  • src/wp-admin/includes/class-wp-privacy-policy-content.php

    diff --git a/src/wp-admin/includes/class-wp-privacy-policy-content.php b/src/wp-admin/includes/class-wp-privacy-policy-content.php
    index 65f27470a3..acd5878060 100644
    a b final class WP_Privacy_Policy_Content { 
    318318                        return;
    319319                }
    320320
     321                $current_screen = get_current_screen();
    321322                $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
    322323
    323                 if ( ! $policy_page_id || $policy_page_id !== $post->ID ) {
    324                         return;
    325                 }
    326 
    327324                $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
    328325                $url     = esc_url( admin_url( 'privacy-policy-guide.php' ) );
    329326                $label   = __( 'View Privacy Policy Guide.' );
    330327
    331                 if ( get_current_screen()->is_block_editor() ) {
    332                         wp_enqueue_script( 'wp-notices' );
    333                         $action = array(
    334                                 'url'   => $url,
    335                                 'label' => $label,
    336                         );
    337                         wp_add_inline_script(
    338                                 'wp-notices',
    339                                 sprintf(
    340                                         'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
    341                                         $message,
    342                                         wp_json_encode( $action )
    343                                 ),
    344                                 'after'
    345                         );
    346                 } else {
    347                         ?>
    348                         <div class="notice notice-warning inline wp-pp-notice">
    349                                 <p>
    350                                 <?php
    351                                 echo $message;
    352                                 printf(
    353                                         ' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
    354                                         $url,
    355                                         $label,
    356                                         /* translators: Accessibility text. */
    357                                         __( '(opens in a new tab)' )
     328                if ( 'post' === $current_screen->base && $policy_page_id === $post->ID ) {
     329                        if ( get_current_screen()->is_block_editor() ) {
     330                                wp_enqueue_script( 'wp-notices' );
     331                                $action = array(
     332                                        'url'   => $url,
     333                                        'label' => $label,
     334                                );
     335                                wp_add_inline_script(
     336                                        'wp-notices',
     337                                        sprintf(
     338                                                'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
     339                                                $message,
     340                                                wp_json_encode( $action )
     341                                        ),
     342                                        'after'
    358343                                );
     344                        } else {
    359345                                ?>
    360                                 </p>
    361                         </div>
    362                         <?php
     346                                <div class="notice notice-warning inline wp-pp-notice">
     347                                        <p>
     348                                        <?php
     349                                        echo $message;
     350                                        printf(
     351                                                ' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
     352                                                $url,
     353                                                $label,
     354                                                /* translators: Accessibility text. */
     355                                                __( '(opens in a new tab)' )
     356                                        );
     357                                        ?>
     358                                        </p>
     359                                </div>
     360                                <?php
     361                        }
    363362                }
    364363        }
    365364