Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Remove the REST API and oEmbed links

Removes the REST API and oEmbed discovery links from the page head and the HTTP headers. The REST API itself keeps working.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Tested with WordPress 7.1
PHP
<?php

remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'template_redirect', 'rest_output_link_header', 11 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );

Good to know

Other WordPress sites use the oEmbed links to show a preview card when someone pastes a link to your posts. Leave this off if you want those previews.

In these packs

  • Clean up the head: Remove the links, scripts and styles WordPress adds to every page that most sites never use.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.