Site logo

Archived topic

Unable to execute PHP in Element when DISALLOW_FILE_EDIT is set to true

5 replies · Started by Aldrin on February 4, 2021

Viewing posts 1–6 of 6

Hi, I searched and saw a few topics on this but there must be some kind of work around. Some security plugins add or when you manually add define('DISALLOW_FILE_EDIT', true); to wp-config.php to protect the site, PHP isn't able to execute when using some in element header hooks.

What is the solution? I haven't yet seen one on this forum.

Hi there,

The solution is different for every case - it depends on what is causing it.

Are you using a security plugin?

Does the message shown when all other plugins are disabled?

Sometimes your hosting might have some default security that disallows the execution of PHP as well.

Hi Leo, no, what I mean is there must be a solution to use DISALLOW_FILE_EDIT to true and not have the element hook run PHP. :) As I mentioned yes, security plugins do add the DISALLOW_FILE_EDIT to yes to wp-config.php so removing it is pointless if you're securing the site. I already know that this is causing an issue.

I would like to be able to have DISALLOW_FILE_EDIT to yes and be able to use execute PHP in element hooks.

Hope I'm being clear

Yes!!!! This is exactly what I needed Leo. Thank you. So this function add_filter( 'generate_hooks_execute_php', '__return_true' ); enables PHP exectution in the element header but still disallows file edit site wide? I did try it and it works

Glad to hear :)

This archived topic is closed to new replies.