Quantcast
Channel: User janh - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 40

Answer by janh for Video embeds work in backend, but are not parsed in frontend

$
0
0

I've just looked at the source of the WP_Embed class, and it appears they are not actually registering a shortcode, but hooking into the the_content filter.

Change your code to

$content_desktop = apply_filters("the_content", get_the_content());

or manually trigger their filter with something like

$content_desktop = WP_Embed::run_shortcode(get_the_content());

or, if you prefer to have an object:

$myembeds = new WP_Embed;$content_desktop = $myembeds->run_shortcode(get_the_content());

See also WP_Embed::run_shortcode in the codex, and the source code of class-wp-embed.php.


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>