Support

Account

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