admin管理员组

文章数量:1122846

I have a page: /

I have discovered this as well: /

There is no page for that second URL, and I cannot find a way to remove it.

Any thoughts?

I have a page: https://med.uth.edu/ortho/houston-ortho-trauma/

I have discovered this as well: https://med.uth.edu/ortho/houston-ortho-trauma/embed/

There is no page for that second URL, and I cannot find a way to remove it.

Any thoughts?

Share Improve this question asked Jun 12, 2024 at 14:04 CarlosCarlos 111 bronze badge 1
  • 1 those are for OEmbeds, it's not a separate page it's the same page, in the same way that you can append /feed to an archive URL to see it as an RSS feed, or /2 for the second page – Tom J Nowell Commented Jun 12, 2024 at 14:49
Add a comment  | 

1 Answer 1

Reset to default 1

This pages can be generated in WP, or by plugins and are intended to allow the page to be embedded on other websites. If you do not want them they can be "removed" via an .htaccess rule:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)/embed/?$
RewriteRule ^(.*)/embed/?$ %1 [R=301,L]

Or a custom function in your functions.php file:

function disable_embeds_code_init() {
    // Remove the REST API endpoint.
    remove_action('rest_api_init', 'wp_oembed_register_route');
    // Turn off oEmbed auto discovery.
    add_filter('embed_oembed_discover', '__return_false');
    // Don't filter oEmbed results.
    remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
    // Remove oEmbed discovery links.
    remove_action('wp_head', 'wp_oembed_add_discovery_links');
    // Remove oEmbed-specific JavaScript from the front-end and back-end.
    remove_action('wp_head', 'wp_oembed_add_host_js');
}
add_action('init', 'disable_embeds_code_init', 9999);

You can read more about oembed links here: What are the Oembed Links For?

If you check your source code you will see the links, they start with:

link rel="alternate" type="application/json+oembed"

本文标签: url ends in quotembedquot