Computer Science Mojo

~ David's Notes on coding, software and computer science


How to remove Wordpress versioning, emoji scripts, admin bar

Category: Web     Tag: WordPress  
By: David     On: Sat 20 January 2018     

By default, Wordpress adds in an emoji script and it's versioning into wp_head, one may want to remove these for simplicity and security. The admin bar too can also be removed.


  • Wordpress 4.9.x

Source Code

In theme's functions.php:

function mytheme_cleanup(){
    // remove header emoji
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );

    // remove wp version and unecessary
    remove_action( 'wp_head', 'wp_generator');
    remove_action( 'wp_head', 'wlwmanifest_link');
    remove_action( 'wp_head', 'rsd_link');
    remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0);

    // remove admin bar
add_action('after_setup_theme', 'mytheme_cleanup');