Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Enable a short code in the custom meta field WordPress


I was wondering if there is a filter that allows me to enable short codes to work inside the custom meta fields in my posts.

I know the following code enables it in widgets:

add_filter('widget_text', 'do_shortcode');

And where would I have to put a code? My theme has shortcodes.php also meta-boxes.php

P.S I've asked this question on

[[LINK href="null"]][[/LINK]]

And I also found some similar question here:

But I can't figure out where to put these codes that they are offering? I've called my custom field "best" (without quotes). So if what they say is true the code I need to use should look like this echo <?php do_shortcode( get_post_meta($post->ID, 'best', true) ); ?>

Answers (4)


Bob answers:

This thing depends on where you want to use metabox in your theme files.

you can use either use
<?php echo do_shortcode( get_post_meta($post->ID, 'best', true) ); ?>


<?php echo apply_filters('the_content', get_post_meta($post->ID, 'best', true)); ?>

Jmantis comments:

I've tried to insert both codes in to my custom field before the short code, but here is what I can see now (see image attached)

Any ideas what I could have done wrong?