Shortcodes don't work in a wysiwyg field but work in regular wordpress body field in pages. Any idea what might be causing this? I'm specifically using formidable forms, but I've also tried with other shortcodes.
I had to wrap the outputted content with do_shortcode.
Were you not filtering your meta data with the_content? That would probably be your better option:
$wysiwyg = apply_filters( 'the_content', get_post_meta( get_the_id(), $prefix . 'wysiwyg_meta_name', true ) );
Arbitrarily picked variable and meta data names. But something like that instead. Note that my example uses a $prefix variable, instead of how the wiki example does it.
$joya_air_page_meta['writers_text'] = do_shortcode(get_post_meta ( $post->ID, '_jo_air_page_writers_text', true ));
Right, I gotcha. I'm just suggesting that you'll probably want to filter a wysiwyg field through the_content instead of using do_shortcode.
You'll still get your shortcodes resolved, but you'll also get all the normal defaults you'd expect from the standard TinyMCE (wysiwyg) editor.
Downside to using the the_content filter is that it's typically used to output things like social sharing icons, and other things that plugins add. Can be a pain.
The wiki actually has an example function for doing this type of thing: https://github.com/WebDevStudios/CMB2/wiki/Field-Types#wysiwyg
Good point, and excellent example snippet there!
I've done this using following code :
$wysiwyg = apply_filters( 'the_content', get_post_meta( get_the_id(), $prefix . 'wysiwyg_meta_name', true ) );
Thanks @yeahsmaggy , the code run well.
@jalberts got the best solution
Thank You!
Most helpful comment
Were you not filtering your meta data with
the_content? That would probably be your better option:Arbitrarily picked variable and meta data names. But something like that instead. Note that my example uses a
$prefixvariable, instead of how the wiki example does it.