I've been trying to get a custom wysiwyg field to output as it normally would when using the_content(). To this end I've been passing the contents of the custom field through apply_filters using the_content filter. However, all this is doing is parsing shortcodes without triggering oembed magic for YouTube URLs.
I've read quite a few blog posts that suggest it needs a post ID (i.e. it needs to be in the loop) leading to solutions like this - http://wordpress.org/support/topic/oembed-filter.
However, my code *is* in the loop as you can see from the_content() being used at the top, which outputs as expected and outputs the correct embed code, so I'm scratching my head about why it's not picking up the YouTube URLs and using oembed.
The other post I've read is here - http://dancameron.org/code/wp_embed-oembed-filter-the_content-post_content/ - which talks about caching, but I'm not quite sure what that refers to (I've had a look at the WP_Embed class, and can't figure it out from there).
Does anyone have any ideas why this wouldn't be picked up? My code is below, which uses slt_cf_field_value() from Developers Custom Fields (http://wordpress.org/plugins/developers-custom-fields/) to retrieve the custom field values:
the_content();
if (slt_cf_field_value('tab_title_1') != '') {
echo '<div id="tab-container" class="tab-container">';
echo '<ul class="etabs">';
for ($i=1;$i<6;$i++) { if (slt_cf_field_value('tab_title_'.$i) !== '') {
echo '<li class="tab"><a href="#tabs'. $i .'">'. slt_cf_field_value('tab_title_'.$i) .'</a></li>';
}}
echo '</ul>';
for ($i=1;$i<6;$i++) { if (slt_cf_field_value('tab_title_'.$i) !== '') {
$tabContent = apply_filters('the_content', slt_cf_field_value('tab_content_'.$i));
echo '<div class="tab-content" id="tabs'. $i .'">'. $tabContent .'</div>';
}}
echo '</div>';
}