WordPress: Shortcode in Custom Field

Normally wordpress does not run shortcode that you put into a custom field. By default, Custom Fields display whatever value you enter, as plain-text, so if you try entering a shortcode, (in the format [shortcode] VALUE [/shortcode]) you’ll end up displaying the entire text, including the tags.

Add the following in your template file, it can be single.php or page.php or else

echo apply_filters('the_content', get_post_meta($post->ID,'your_custom_field',true)); 


echo do_shortcode($shortcode); 


One response to “WordPress: Shortcode in Custom Field”

  1. What about if you have shortcode interspersed with content.  Can you think of a way to do this?  With a filter perhaps?

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: