WordPress uses the oEmbed protocol to allow posts and pages to be embedded on other websites. While this feature is convenient, it can expose your content to unwanted use. On ruachost.com, you can disable remote embedding of your WordPress posts with a simple PHP snippet.

 

Why Disable oEmbed?

  • Prevents third‑party sites from embedding your posts without permission.

  • Reduces bandwidth usage from external requests.

  • Improves site security by limiting exposure.

  • Keeps your content under your control.

 

Steps to Disable oEmbed in WordPress

  1. Log in to WordPress with an administrator account.

  2. In the dashboard, go to Appearance → Theme Editor.

  3. Select your active theme and open the functions.php file.

  4. Add the following code snippet at the end of the file:

    // Disable oEmbed functionality in WordPress
    function disable_oembed() {
        wp_dequeue_script('wp-embed');
    }
    add_action('wp_footer', 'disable_oembed');
    
     
  5. Click Update File to save changes.

  6. Refresh your site → WordPress posts can no longer be embedded remotely.

 

Important Notes

  • Always back up your theme files before editing.

  • Use a child theme to preserve changes during theme updates.

  • Disabling oEmbed does not affect internal embeds (e.g., embedding YouTube videos in your own posts).

  • If you later want to re‑enable oEmbed, simply remove the code snippet.

 
War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)

Powered by WHMCompleteSolution