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:
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!
© 2023 Advanced Custom Fields.