[Support request] updating define( 'GENERATE_HOOKS_DISALLOW_PHP', true );

Home Forums Support [Support request] updating define( 'GENERATE_HOOKS_DISALLOW_PHP', true );

Home Forums Support updating define( 'GENERATE_HOOKS_DISALLOW_PHP', true );

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #658962
    Russell

    on a localhost….

    I recently updated to GP Elements. I noticed in Snippets, I have a bid of code

    define( ‘GENERATE_HOOKS_DISALLOW_PHP’, true );

    under the title of “disallowing php in gp hooks”

    i’ve read this related article https://docs.generatepress.com/article/disallow-php-execution/

    my questions are:
    1) how does this code in snippets relate to the move to gp elements? does it stay or go?
    2) I check the wp-config.php file and since I use themes security define( ‘DISALLOW_FILE_EDIT’, true ) is present.
    3) with 1 & 2 above, do I create a new hook in elements? and if so, how do I do that, etc… or leave it as is? ect.

    thanks.

    #659015
    Leo
    Staff
    Customer Support

    Hi there,

    If you have the code in 2) then you shouldn’t need the code in 1).

    You can still create new hooks in Hooks Element, they just can’t include PHP code.

    Let me know if this helps 🙂

    #1697589
    Greg

    The code at https://docs.generatepress.com/article/disallow-php-execution/#removing-the-admin-message does not work to enable PHP execution in Elements while DISALLOW_FILE_EDIT is true. Like a number of other people in the forums I see, I need this to work. It does not even make sense to bind PHP in Elements to DISALLOW_FILE_EDIT in the first place, so it’s doubly frustrating that there isn’t a workaround.

    #1697602
    Greg

    After looking through the source code, I found the generate_hooks_execute_php filter. This code should replace the code in the documentation:

    add_filter( 'generate_hooks_execute_php', '__return_true' );

    #1697869
    Leo
    Staff
    Customer Support

    Thanks!

    I’ll update the doc to include that filter.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.