Skip to main content

Troubleshooting: Advanced Custom Fields and Shortcodes

August 19, 2016
|

I ran into a small problem where my ACF text fields and textareas with shortcodes in them, on a new WordPress page template, were not working. I took different steps to try and troubleshoot this issue, making sure that the shortcodes were correct in the backend and that the theme was not stripping them in any way. I know placing shortcodes in custom fields instead of just using do_shortcode() in the template may seem a little roundabout to some developers. For us frontend developers here at Eyesore Inc, we prefer to keep as much of the content easily editable from the WP backend. I’m personally satisfied with having about 95% of any content within arms reach. We prefer to give our clients the opportunity to update their sites as they please and we’re more than happy to answer any emails in a guidance capacity, if it means our clients can grow more comfortable with their websites.

Anyways, as a test, I simply put the shortcodes in the page’s wysiwyg and they worked! Apparently, shortcodes in ACF text fields and textareas don’t run. Replacing these with wysiwyg fields cleared up the problem and the shortcodes began working correctly, in their proper places.