I find the 3.3 Tooltips annoying when I’m upgrading many live and dev sites. How do I disable them via functions.php? Unenqueue wp-includes/js/wp-pointer.js ?
2 Answers
You could also remove the pointer script and style from their respective arrays just after they have been registered using this method.
// Remove javascript
add_action( 'wp_default_scripts' , 'remove_pointer_script' );
function remove_pointer_script( $wp_scripts ) {
$wp_scripts->remove('wp-pointer');
}
// Remove stylesheet
add_action( 'wp_default_styles' , 'remove_pointer_style' );
function remove_pointer_style( $wp_styles ) {
$wp_styles->remove('wp-pointer');
}
The remove
method is part of the dependencies class which is extended by both the WP_Scripts
and WP_Styles
classes, it basically does the inverse of the add
method, which is used inside core to register default scripts and styles. Mentioned incase you’re curious where that method comes from and what it’s for..
I suppose you could also encapsulate those actions in a current_user_can
check also if you wanted to wipe them out for specific users, say admins.
if( current_user_can( 'manage_options' ) ) {
add_action( 'wp_default_scripts' , 'remove_pointer_script' );
add_action( 'wp_default_styles' , 'remove_pointer_style' );
}
Personally i quite like the new tooltips, and it’s quite a shame there’s not a simple API available for utilizing them in plugins yet, but i can see how it could be annoying when you’re doing numerous installs or upgrades and just need to get things done.