I put these code in functions.php to custom what I need.
before I add these code,the back_end`s ttfb is 746ms.
after adding,the ttfb is 3.6s !!!
speed becomes slow obviously!
Is there any way to optimize ?
**//back_end footer text**
add_filter('admin_footer_text', 'left_admin_footer_text');
function left_admin_footer_text($text) {
//left text
$text = '';
return $text;}
add_filter('update_footer', 'right_admin_footer_text', 11);
function right_admin_footer_text($text) {
//right text
$text = "Power by Ateam";
return $text;}
//Logo`s URL
function my_loginURL() {
return '#';
}
add_filter('login_headerurl', 'my_loginURL');
//login page logo text
function my_loginURLtext() {
return 'Powered by Ateam';
}
add_filter('login_headertitle', 'my_loginURLtext');
//hide the back_end logo
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
//hide the hlep tabs
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}
//stop the update notice (Core)
remove_action ('load-update-core.php', 'wp_update_themes');
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
//stop the update notice(Plugins)
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
//stop the update notice (Themes)
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
//stop the update (theme)
add_filter( 'auto_update_theme', '__return_false' );
//stop the update (plugins)
add_filter( 'auto_update_plugin', '__return_false' );
//stop the back_ends notices
function pr_disable_admin_notices() {
global $wp_filter;
if ( is_user_admin() ) {
if ( isset( $wp_filter['user_admin_notices'] ) ) {
unset( $wp_filter['user_admin_notices'] );
}
} elseif ( isset( $wp_filter['admin_notices'] ) ) {
unset( $wp_filter['admin_notices'] );
}
if ( isset( $wp_filter['all_admin_notices'] ) ) {
unset( $wp_filter['all_admin_notices'] );
}
}
add_action( 'admin_print_scripts', 'pr_disable_admin_notices' );
I put these code in functions.php to custom what I need.
before I add these code,the back_end`s ttfb is 746ms.
after adding,the ttfb is 3.6s !!!
speed becomes slow obviously!
Is there any way to optimize ?
**//back_end footer text**
add_filter('admin_footer_text', 'left_admin_footer_text');
function left_admin_footer_text($text) {
//left text
$text = '';
return $text;}
add_filter('update_footer', 'right_admin_footer_text', 11);
function right_admin_footer_text($text) {
//right text
$text = "Power by Ateam";
return $text;}
//Logo`s URL
function my_loginURL() {
return '#';
}
add_filter('login_headerurl', 'my_loginURL');
//login page logo text
function my_loginURLtext() {
return 'Powered by Ateam';
}
add_filter('login_headertitle', 'my_loginURLtext');
//hide the back_end logo
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
//hide the hlep tabs
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}
//stop the update notice (Core)
remove_action ('load-update-core.php', 'wp_update_themes');
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
//stop the update notice(Plugins)
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
//stop the update notice (Themes)
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
//stop the update (theme)
add_filter( 'auto_update_theme', '__return_false' );
//stop the update (plugins)
add_filter( 'auto_update_plugin', '__return_false' );
//stop the back_ends notices
function pr_disable_admin_notices() {
global $wp_filter;
if ( is_user_admin() ) {
if ( isset( $wp_filter['user_admin_notices'] ) ) {
unset( $wp_filter['user_admin_notices'] );
}
} elseif ( isset( $wp_filter['admin_notices'] ) ) {
unset( $wp_filter['admin_notices'] );
}
if ( isset( $wp_filter['all_admin_notices'] ) ) {
unset( $wp_filter['all_admin_notices'] );
}
}
add_action( 'admin_print_scripts', 'pr_disable_admin_notices' );
There's one thing here you shouldn't do:
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
add_filter( 'pre_set_site_transient_update_plugins', create_function( '$a', "return null;" ) );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
In my testing, this slowed down the admin side of the site significantly on a fresh local install. This is because if the the transients update_core
, update_plugins
, and update_themes
are not found, they go back to object cache for an answer. If you're not using object cache which isn't setup by default, the request goes all the way back to the database.
I did some rough benchmarking on a fresh install. A typical admin request calls one of these transients up to 17 times in a single request. When you're logged in and looking at the front-facing site it can be up to 5. That adds up.
Fortunately, Jason Jalbuena has found a better way:
function remove_core_updates () {
global $wp_version;
return(object) array(
'last_checked'=> time(),
'version_checked'=> $wp_version,
'updates' => array()
);
}
add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');
Source: https://jasonjalbuena/disable-wordpress-update-notifications/
This works because it does not remove the transient, it only replaces it with values that trick WordPress into thinking the check has happened and nothing needs to be updated.