Site logo

Archived topic

Using embed_oembed_html

4 replies · Started by Derek on June 27, 2020

Viewing posts 1–5 of 5

I tried adding the following code to the functions.php file to change the output of an embedded Youtube video but nothing changes. I tried this with a plain WordPress install and changing to the Twenty Twenty theme and it worked with that theme but not GeneratePress.

add_filter( 'embed_oembed_html', 'append_oembed_html', 99, 4 );
 
function append_oembed_html( $cache, $url, $attr, $post_id ) {
    if ( false !== strpos( $url, "://youtube.com") || false !== strpos( $url, "://youtu.be" ) ) {
        $cache =  $cache . '<br>video link: '. $url .'';
    }
    return $cache;
}

I see now that it is rendering but underneath the video and inside a figure and div tag

Hi there,

GeneratePress itself shouldn't alter the content output at all. Any chance you can link us to the page so we can take a closer look?

Let me know :)

I see that it's not a generatepress problem as the same code is generated for both generatepress and twenty twenty themes on a clean WordPress install. There must be another plugin that is causing the change to not appear at all in one of my projects. Thanks

No problem!

This archived topic is closed to new replies.