WordPress 10個不為人知的技巧




Remove WordPress Admin Notices with Code

use this code snippet. You can add it anywhere in the functions.php file or wp-config.php file of WordPress.

add_action('admin_enqueue_scripts', 'ds_admin_theme_style');
add_action('login_enqueue_scripts', 'ds_admin_theme_style');
function ds_admin_theme_style() {
	if (!current_user_can( 'manage_options' )) {
		echo '<style>.update-nag, .updated, .error, .is-dismissible { display: none; }</style>';

disable all Plugin Notifications you can use the following code:

add code directly at the end of the functions.php

//Disable automatic plugin updates
add_filter( ‘auto_update_plugin’, ‘__return_false’ );
//Disable plugin update notifications

Disable Automatic WordPress Updates

add the following code to your wp-config.php file:

define( 'WP_AUTO_UPDATE_CORE', false );

disable automatic plugin updates, add the following code to the bottom of the file:

add_filter( 'auto_update_plugin', '__return_false' );

Protect your WP-config.php

Copy the below text at the bottom of your .htaccess file, after all other entries.

# protect wpconfig.php
<files wp-config.php&gt;
order allow,deny
deny from all

Secure the wp-config.php File

Set the file permissions to 600 so that only true owners can edit the wp-config file

Scroll to Top