
By default, WordPress do not allows shortcodes to be executed inside custom fields. If for some reason you need to be able to execute a shortcode inside a specific custom field, here is an easy way to do it.

By default, WordPress do not allows shortcodes to be executed inside custom fields. If for some reason you need to be able to execute a shortcode inside a specific custom field, here is an easy way to do it.
Just put this code into whatever page you are displaying the results of the shortcode, and change the your_custom_field_here to the name of your custom field.
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'your_custom_field_here', true)); ?>
Credit: Snipplr.
5 Responses
Why not just ID, ‘your_custom_field_here’, true)’); ?>
Since my last comment got partially eaten, why not just use do_shortcode() ?
Many thanks, it worked like charm
very good. thanks for sharing this. it worked.
Why use apply_filters beside do_shortcode function?
ID, ‘cfield’, true) )
echo do_shortcode(get_post_meta($post->ID, ‘cfield’, $single = true));
?>
Trackbacks: