Support

Account

Home Forums Front-end Issues Execute PHP SCRIPT

Helping

Execute PHP SCRIPT

  • Hello i just want to know how i can create a custom field, where i can put my php script inside so tha it works on the frontend.

    thanks felix

  • Hi @felix1337

    Before you proceed with this, please realize the security hole this will cause in your website. If a spam attack was to ever inject code into your DB, your website could actually run it!

    This aside, you can use a text field to save any code. Then on the front end, you can run it like so:

    
    $code = get_field('code');
    eval( $code );
    

    Ref: http://www.php.net/eval

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Execute PHP SCRIPT’ is closed to new replies.