How to disable embedding of WordPress posts remotely on 3rd party sites

oEmbed is a format that allows a URL to be embedded on third-party websites. When a user posts a link to a resource, the simple API allows a website to display embedded content (such as photos or videos) without having to parse the resource directly. This function enables the remote embedding of any WordPress blog. This article will show you how to disable the oEmbed functionality to prevent anyone from remotely embedding your WordPress blog post

Disabling oEmbed in WordPress

To disable oEmbed in WordPress, follow these steps:

  1. Log in to WordPress as the administrator.
  2. On the Dashboard in the left sidebar, click Appearance, and then click Editor:

  3. On the Theme Editor , select the Theme you want to edit from the dropdown:

  4. The files for this selected theme are listed on the right column under Theme Files. Click on the file named “functions.php”:

  5. Insert the following code to the end of functions.php file and click Update File Button to save the changes:

    function no_embed() {
    
      wp_dequeue_script('wp-embed');
    
    }
    
    add_action('wp_footer', 'no_embed');
    
  6. This code prevenst the related JS file from loading and other from embedding your blog posts from wordpress site.

More Information

For more information about oEmbed, please visit https://oembed.com/

Get Managed WordPress Hosting

Article Details

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.