Archived topic
Unable to execute PHP in Hooks Element
2 replies · Started by Ajay Nehra on January 13, 2022
today i did file edit disallow from inside wp-config.php file and after DISALLOW_FILE_EDIT true i got this error "Unable to execute PHP as DISALLOW_FILE_EDIT is defined"
I searched about this on your website and I found 2 articles for this.
Article 1 - https://docs.generatepress.com/article/generate_hooks_execute_php/
Article 2 - https://docs.generatepress.com/article/disallow-php-execution/
I got 2 different codes from these two articles
add_filter( 'generate_hooks_execute_php', '__return_true' ); (from article 1)
define( 'GENERATE_HOOKS_DISALLOW_PHP', true ); (from article 2)
Q.1 - I want to know about these two codes, which code should be used when? and which code does what?
Q.2 - What is the difference between these two codes?
Q.3 - Can I use both codes? Will this be safe?
Please answer keeping in mind the security of the website and file edit should be disallowed
Hi Ajay,
The 2nd article is out of date, it was for the hooks before elements module were introduced.
So you just need to use this filter:
add_filter( 'generate_hooks_execute_php', '__return_true' );
Done