Home › Forums › Add-ons › Flexible Content Field › Can I run PHP in a flexible content field? › Reply To: Can I run PHP in a flexible content field?
Hi @pringletech
Yes, you can add PHP code to a textarea field (with a flexible content layout), and then execute it with the eval
function like so:
$code = get_field('code');
eval( $code );
Please note the above uses get_field
, if you wish to use this within a flexible content field, you will need to use get_sub_field
instead. Please refer to the dos for more on this.
Thanks
E
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.