How TO Remove WP API links and Scripts From header

WordPress REST API manages the communication between your site and other Web apps.  But a lot of sites don’t use the REST API. It loads script and links in header area something like the coding line. 

					<link rel='' href='' />

This line loads on your pages header source. It’s better to remove this unwanted code from your head area. 

How to Remove WP REST API Links & Scripts

Watch the following code. First copy the code and navigate to your Theme’s function.php file. Edit the function.php file via any text or code editor. 

Just paste the code and save that function.php file.

					// Remove Head API 
remove_action('wp_head', 'rest_output_link_wp_head');
remove_action('wp_head', 'wp_oembed_add_discovery_links');

Remove WP REST API Links using Adminify

After login to your website dashboard, you will see “WP Adminify” option. [If you have installed and activated Adminify already]

If you can’t see the option then you have to install Adminify Plugin first.

Now click on this WP Adminify option and navigate to “Tweaks” then “WP JSON API” menu. Take a look at the third option called “Remove WP API Links and Scripts“. Just enable and save it.

Remove WP API Links and Scripts from WordPress head
Was this article helpful?