0

Is there a way to search all posts and pages in my WordPress site and find those who have a Youtube video embedded in them?

The reason to do that is I want to disable the wp-embed.min.js but before doing that, I need to confirm there are no posts or pages that embed Youtube videos.

Update

I create a test post and embed a Youtube video in it, and then check the HTML source, and find the following one:

<div class="rll-youtube-player" data-src="https://www.youtube.com/embed/A1iB6ZfB4kI" data-id="A1iB6ZfB4kI" data-query="feature=oembed"></div><noscript><iframe title="How to Use DataNumen Outlook Repair to Recover Corrupt Outlook PST Files" width="500" height="281" src="https://www.youtube.com/embed/A1iB6ZfB4kI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></noscript>

I then use the following query to search in database:

SELECT * FROM `wp_posts` WHERE `post_content` LIKE '%oembed%'

However, the found posts are all not normal posts, i.e., do not have a post_title, and I check post_type and find they are all oembed_cache. Does that mean there are no Youtube embedded in all posts? If yes, then why there are so many oembed_cache posts?

4
  • Do you have access to the database and are familiar with the interface you have (e.g. PHPMyAdmin)? The embed probably looks something like wp:core-embed/youtube (at least it used to!), so if you search the DB for this string in post_content of wp_posts, you know if some exist or not.
    – kero
    Commented Oct 14, 2021 at 9:24
  • @kero, Thank you very much for your comment. I try to use query SELECT * FROM wp_posts WHERE post_content LIKE '%wp:core-embed/youtube%' but cannot find any results. I also use another keyword but find some oembed_cache posts. I have updated my original question.
    – alancc
    Commented Oct 14, 2021 at 21:51
  • Maybe someone else can answer better, I'm not very familiar. But reading this it seems oembed_cache is used by the block editor. So the presence of entries suggests that at some time, these were embedded (though not clear if still embedded or not).
    – kero
    Commented Oct 15, 2021 at 10:05
  • @kero, Thank you. I do find some posts with Youtube embedded, with keyword "youtu.be", but they are not affected by wp-embed.min.js. Even wp-embed.min.js is disabled, they can sill load Youtube videos.
    – alancc
    Commented Oct 15, 2021 at 21:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.