Featured Video Play Icon

Removing wordpress version from source code

WordPress Tutorial: In simple steps, going to show you how to add remove WordPress version from source code. The following codes are tested by using WordPress Child Theme.

Step 1: Open functions.php file ( Assuming you are using WordPress child theme)

Step 2: Add this below code

/*==========================================
Remove version from head
===========================================*/
remove_action('wp_head', 'wp_generator');
/*==========================================
Remove version from rss
===========================================*/
function remove_feed_generator() {
return '';
}
add_filter('the_generator', 'remove_feed_generator');
/*==========================================
Remove version from scripts and styles
===========================================*/
function remove_version_scripts_styles($src) {
    if (strpos($src, 'ver=')) {
        $src = remove_query_arg('ver', $src);
    }
    return $src;
}
add_filter('style_loader_src', 'remove_version_scripts_styles', 9999);
add_filter('script_loader_src', 'remove_version_scripts_styles', 9999);

Step 3: Save it and you are done.

Published by

Emdad Khan

I am Emdad – A wordpress lover. I do website development using wordpress as well as blogging. My wordpress blogs mainly for new wp lover who is interested to learn about wordpress and want to master on it. Keep exploring Bn Web Design.

Leave a Reply