Just learning about this plugin and have seen it used in a site but have a quick question.
Can I insert straight PHP code into a block and have it executed. My goal is to query and display data located in an external table in the WP database in a page currently constructed with ACF Flexible content.
Thanks in advance,
Scott
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