Remove JSON API links in header html

Does anyone know how to remove the WordPress JSON API links in the header tag?

<link rel="" href="" />
<link rel="alternate" type="application/json+oembed" href="" />
<link rel="alternate" type="text/xml+oembed" href="" />

I’d like to avoid using a plugin. If possible, is there a way to remove them with the remove_action function?

remove_action( 'wp_head', 'rsd_link' );


I see in filters.php “add_action( ‘wp_head’, ‘rest_output_link_wp_head’, 10, 0 )” Which makes me think this should do the trick to remove rel="".

remove_action( 'wp_head',      'rest_output_link_wp_head'              );

The rest… * cough * seem to be in default-filters.php

remove_action( 'wp_head',      'wp_oembed_add_discovery_links'         );

To remove the rest_output_link_header

remove_action( 'template_redirect', 'rest_output_link_header', 11 );


  • wp_oembed_add_discovery_links
  • rest_output_link_wp_head
  • rest_output_link_header

Leave a Comment