Sunday, July 22, 2012

How to execute shortcodes inside custom fields in wordpress

How to execute shortcodes inside custom fields in wordpress

WordPress by default do not allows shortcodes to be executed inside custom fields. If you want to display something with the help of shortcode inside a specific custom field, then you have to follow the simple steps

Put the following code into whatever page where you are displaying the results of the shortcode, and then change the my_wp_custom_field_here to the name of your own custom field.

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

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off