how to get shortcodes to work inside the text of custom fields

I am building a learning management system using WordPress, custom fields, and various plugins, especially SIMPLE FIELDS by Par Thernstrom. My shortcode plugins, such as Shortcode Exec PHP and Custom Field Value, work fine in the main editing box, but if I put any of my course information shortcodes into a custom field, they don’t work in the custom field. I know that prevents “circular reference” problems, but it also prevents me form building a more streamlined system. Do you know of any workarounds that would allow plugins to operate on the contents of custom fields, so that custom fields could contain shortcodes? The specific configuration that I most need is for shortcodes from Shortcode Exec PHP to work on the wysiwyg textarea input boxes of SIMPLE FIELDS.

The problem is that right now, the custom field text managed by the SIMPLE FIELDS plugin is not evaluated by WordPress for the presence of shortcodes of any sort, or for the presence of PHP code, as far as I can see from my experiments. Just as you might want to put shortcodes for teacher-name or text-book1 in the main edit box, one might also want to insert such local or global data strings into one or more custom fields.

Read More

There are a variety of text replacement plugins available, and so far as I can see they all work fine in the main edit window or a page or post, and none of them work if inserted into the text of a custom field.

Related posts

Leave a Reply

1 comment

  1. Pass the content in do_shortcode() will process all the shortcodes in it. So either make the change in your theme or plugin according to your setup.

    // Lets say $data contains custom field data including shortcodes
    $processed_data = do_shortcode( $data ); // will contain processed shortcodes