Archived topic
updating define( 'GENERATE_HOOKS_DISALLOW_PHP', true );
4 replies · Started by Russell on August 24, 2018
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.
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 :)
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.
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' );
Thanks!
I'll update the doc to include that filter.