Support

Account

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 🙂