How to edit wp_head();, remove content?

wp_head(); is a wordpress built-in function, there is no place to edit and remove the code from there.

The content you see in your head tag is located inside the functions.php file from the current theme that you are using.

Open functions.php and add this code at the bottom.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link');
remove_action('wp_head', 'shortlink');
 
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
 
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 );

Also, if you see bootstrap or jquery and you want to remove those so you can add them in the footer, look for “global $wp_scripts;” or something similar or just do a search for “bootstrap” as keyword. All this also from functions.php from your theme.

You will see some results. Start to delete the code, bootstrap and jquery and refresh the source code in the browser.

It’s pretty easy. If you need more help, leave in the comments.

ADD A COMMENT: