Make WordPress Core

Ticket #47718: 47718.diff

File 47718.diff, 1.7 KB (added by donmhico, 7 years ago)

Display an admin notice in wp-admin/options.php page.

  • src/wp-admin/includes/admin-filters.php

    diff --git src/wp-admin/includes/admin-filters.php src/wp-admin/includes/admin-filters.php
    index c080fd0f24..e62dd13780 100644
    add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_up 
    148148
    149149// Append '(Draft)' to draft page titles in the privacy page dropdown.
    150150add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );
     151
     152// Show warning notice on wp-admin/options.php page.
     153add_action( 'admin_notices', 'wp_admin_options_php_page_warning_admin_notice' );
     154 No newline at end of file
  • src/wp-admin/includes/options.php

    diff --git src/wp-admin/includes/options.php src/wp-admin/includes/options.php
    index 7911abcfba..fc5d5261f5 100644
    function options_reading_blog_charset() { 
    131131        echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
    132132        echo '<p class="description">' . __( 'The <a href="https://wordpress.org/support/article/glossary/#character-set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
    133133}
     134
     135/**
     136 * Display a warning notice to admin to be careful inside the options.php.
     137 *
     138 * @since 5.3
     139 */
     140function wp_admin_options_php_page_warning_admin_notice() {
     141        global $pagenow;
     142
     143        if ( 'options.php' != $pagenow ) {
     144                return;
     145        }
     146       
     147        echo '<div class="notice notice-warning">';
     148        echo '<p><strong>' . __( 'WARNING!' ) . '</strong></p>';
     149    echo '<p>' . __( 'This page allows direct access to your site settings. You can break things here. Please be cautious!' ) . '</p>';
     150    echo '</div>';
     151
     152}
     153 No newline at end of file