Skip to content

Instantly share code, notes, and snippets.

@jeffreyvr
Created October 23, 2018 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyvr/36af385f0df070674dbc750a8eb77376 to your computer and use it in GitHub Desktop.
Save jeffreyvr/36af385f0df070674dbc750a8eb77376 to your computer and use it in GitHub Desktop.
Adding oEmbed filter in custom WordPress function
<?php
function prefix_get_custom_sidebar() {
global $post, $wp_embed;
$custom_sidebar = get_post_meta( $post->ID, 'custom_sidebar', true );
$custom_sidebar = $wp_embed->autoembed( $custom_sidebar ); // Apply oEmbed filter
return $custom_sidebar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment