Skip to content

fix: don't advertise the oEmbed endpoint in <head> - #498

Merged
oxyc merged 1 commit into
masterfrom
fix/oembed-discovery-links
Nov 17, 2026
Merged

oxyc merged 1 commit into
masterfrom
fix/oembed-discovery-links

Conversation

@oxyc

@oxyc oxyc commented Nov 17, 2026

Copy link
Copy Markdown
Member

WordPress prints <link rel="alternate" type="application/json+oembed" …> (and text/xml+oembed) in every page's <head>. Crawlers follow them, and every such request is a full WordPress REST boot that ends in a 401, because REST is restricted for anonymous visitors. Measured on two shops: 1.2k requests / 1.6k PHP-seconds a day on one, 1.7k / 1.0k on the other.

The only thing lost: another WordPress site can no longer auto-embed these pages as rich oEmbed cards. Social networks use Open Graph, not oEmbed, so link previews are unaffected.

Change

remove_action('wp_head', 'wp_oembed_add_discovery_links') in web/app/mu-plugins/defaults.php, next to the other wp_head cleanups (emoji removal). A fleet default, same file and shape as https://github.com/generoi/gorans/pull/102.

Testing

  • php -l passes.
  • After deploy: wp eval 'var_dump(has_action("wp_head", "wp_oembed_add_discovery_links"));' should print bool(false), and a page's <head> no longer contains +oembed (purge the page cache first).

🤖 Generated with Claude Code

Crawlers follow the oEmbed discovery links, and every request is a full
REST boot that ends in a 401 for anonymous visitors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oxyc
oxyc merged commit 25691b5 into master Nov 17, 2026
1 check passed
@oxyc
oxyc deleted the fix/oembed-discovery-links branch November 17, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant