plugins – Remove embed url for internal links

Question

I have a forum built with bbPress. How can I deactivate embed url for internal links? For the rest of the links I want to be the same like it is right now.
What I tried is this but without any results:

add_action('bbp_get_topic_content', 'remove_embed', 1000, 2);
add_action('bbp_get_reply_content', 'remove_embed', 1000, 2);
function remove_embed($content, $id){
    global $wp_embed;
    if(!stripos($wp_embed->last_url, 'CUSTOM_WORD') !== false){
        remove_action( 'bbp_init', 'bbp_reply_content_autoembed', 8 );
        remove_action( 'bbp_init', 'bbp_topic_content_autoembed', 8 );
    }
    return $content;
}

If I put those remove_action outside of a function it is working fine, but applies for every iframe.

0
Andrew 2 weeks 2023-01-25T05:22:21-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse