How to render shortcode using Advanced Custom Fields

Home / ACF / How to render shortcode using Advanced Custom Fields

As you know, WordPress function do_shortcode() will render whatever shortcode contains and is frequently used in custom templates. But if you want to allow site owners to update shortcodes easily, without messing with template files (and possibly causing PHP errors and white screens of death), you will want to consider using Advanced Custom Fields. All you need to do this to create custom field of text Field Type and then paste your shortcode inside. It could look like this:

revolution slider

In order to render the shortcode, you could do something like this (this goes into template files):

So the idea is to get the field value using get_field(), store it into variable and then render it using do_shortcode(). Also note the use of echo.