Home » Php » php – Disable all WordPress oEmbed Providers except Twitter

php – Disable all WordPress oEmbed Providers except Twitter

Posted by: admin February 25, 2020 Leave a comment

Questions:

I need to block/disable all embeds on WordPress except Twitter, in both the backend and frontend.

How to best do this?

There is a similar question here from nearly 4.5 years ago, but unfortunately I couldn’t get the code in any of the answers to work, and I imagine WordPress core has likely changed significantly during this time.

I see one could use wp_oembed_remove_provider() to remove individual providers, but as WordPress changes providers between updates, this seems untenable to keep them all blocked, except Twitter.

How to&Answers: