Archived topic
Unable to execute PHP as DISALLOW_FILE_EDIT is defined Hook element
3 replies · Started by Prathmesh on January 9, 2021
Hey, I am getting this error “Unable to execute PHP as DISALLOW_FILE_EDIT is defined” while adding the hook element.
Would you please help me fix the issue?
Thanks
Hi there,
Take a look at this article:
https://docs.generatepress.com/article/disallow-php-execution/
Hey Leo,
Thanks for your reply.
I already read that article but I didn't get it.
Basically, I want to add an author bio box using the hook element in my blog posts. And it requires PHP execution. But, as I mentioned earlier, I'm getting the error.
So to get rid of the error and to execute PHP should I add the code mentioned in the article "define( 'GENERATE_HOOKS_DISALLOW_PHP', true );"?
Hi there,
to enable PHP in just the hooks you would add the PHP Snippet provided here to your site:
https://docs.generatepress.com/article/generate_hooks_execute_php/
ie.
add_filter( 'generate_hooks_execute_php', '__return_true' );
Adding PHP to your site:
https://docs.generatepress.com/article/adding-php/