DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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.


  1. Why not just ID, ‘your_custom_field_here’, true)’); ?>

  2. Since my last comment got partially eaten, why not just use do_shortcode() ?

  3. Many thanks, it worked like charm 🙂

  4. very good. thanks for sharing this. it worked.

  5. Why use apply_filters beside do_shortcode function?

    ID, ‘cfield’, true) )
    echo do_shortcode(get_post_meta($post->ID, ‘cfield’, $single = true));

  6. How would you execute a shortcode from within the author bio meta field onto the author bio page? (author.php)

Leave a Comment

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