WordPress tutorials: Enable shortcode in custom field

Wpsnipp – Shortcodes and Custom Fields are two very powerful features of WordPress which allow you to insert any custom content anywhere on your site.Adding this snippet to your theme will enable you to place shortcode into a custom field, make sure you change “your_field_name” to the custom field you place the shortcode.

 

 

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

Leave a comment