Home › Forums › General Issues › ACF Textarea: Show PHP? › Reply To: ACF Textarea: Show PHP?
Hi @darktakua
Just like what you have heard, adding PHP code in a text area is not a good thing to do. Could you please tell me why you can’t add that code in your template file instead? It will keep your server secure and the page layout will be consistent.
If you need to add it in the text area, ACF has a shortcode to do it. Unfortunately, it will only work for simple field types. This page should give you more idea about it (under Does ACF have a Shortcode?): https://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/.
After adding the shortcode, you need to execute it by using the do_shortcode() function like this:
echo do_shortcode(get_field('text_area_field_name'));
You can also create your own shortcode if you need to.
I hope this makes sense 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.