10個不為人知的技巧
現時越來越多人使用wordpress但好多時大家對於lopez都會有一個錯誤嘅觀念就係好多時都會直接使用安裝插件去解決一些問題其實好多時只需要使用一些簡單的代碼就可以代替安裝插件因為安裝越多的插件就會對於網站嘅影響越大
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
add_filter(‘pre_site_transient_update_plugins’,’remove_core_updates’);
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>
order allow,deny
deny from all
</files>
Secure the wp-config.php File
Set the file permissions to 600 so that only true owners can edit the wp-config file