Disabling embedding of WordPress posts remotely on 3rd party sites
oEmbed is a format that allows a URL to be embedded on third-party websites.This article will show you how to disable the oEmbed functionality to prevent anyone from remotely embedding your WordPress blog post.
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:
-
Log in to WordPress as the administrator.
-
On the Dashboard in the left sidebar, click Appearance, and then click Editor:
-
On the Theme Editor, select the Theme you want to edit from the dropdown:
-
The files for this selected theme are listed on the right column under Theme Files. Click on the file named "functions.php":
-
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');
- 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/
Related Articles
Updated 3 days ago