- This topic has 35 replies, 8 voices, and was last updated 6 years, 5 months ago by Leo.
-
AuthorPosts
-
June 21, 2017 at 12:42 pm #337060Gideon
Hi,
Since updating GP I am getting this message:
DISALLOW_FILE_EDIT is defined. You should also disallow PHP execution in GP Hooks.
I found te article stating that I should add the following to GP Hooks:
define( ‘GENERATE_HOOKS_DISALLOW_PHP’, true );Do I need to place this in a specific section?
It looks like it’s not working as I still get the message.
Thanks!
June 21, 2017 at 12:57 pm #337071LeoStaffCustomer SupportHi there,
Try adding that line using Code Snippets: https://docs.generatepress.com/article/adding-php/#code-snippets
June 21, 2017 at 1:51 pm #337100GideonThanks for your reply Leo!
I am still getting the message though…
June 21, 2017 at 1:53 pm #337101LeoStaffCustomer SupportHmm just tried it and it worked for me.
Can you make sure to click Save and Activate on the snippet?
June 21, 2017 at 2:04 pm #337113TomLead DeveloperLead DeveloperYou can also add it to your wp-config.php file, which is where
DISALLOW_FILE_EDIT
is usually defined.That being set, it should work anywhere, including Code Snippets.
June 21, 2017 at 2:08 pm #337115GideonThat’s weird as I did save and activate the code snippet…
I also added it to several sections within GP Hooks before adding the code snippet.June 21, 2017 at 2:09 pm #337116TomLead DeveloperLead DeveloperIt won’t work in GP Hooks, but will in Code Snippets, child theme functions.php or wp-config.php.
Is it still not working with the snippet activated?
June 21, 2017 at 2:15 pm #337122GideonThat’s correct
I have added this to the code snippet:
define( ‘GENERATE_HOOKS_DISALLOW_PHP’, true );
Also saved and activated it
It should run everywhere (selected for the code snippet)
However, still getting the message
June 21, 2017 at 4:24 pm #337151TomLead DeveloperLead DeveloperYou may need to add it to your wp-config.php file then.
Or try this:
add_action( 'after_setup_theme', 'tu_disable_php_in_hooks' ); function tu_disable_php_in_hooks() { define( 'GENERATE_HOOKS_DISALLOW_PHP', true ); }
June 21, 2017 at 11:53 pm #337242LucaHey, Tom.
Sorry to “hijack” another user’s thread. I just wanted to mention that whilst such a warning makes sense, IMHO it should have probably been wrapped within an “if(!current_user_can(‘manage_options’))” as this way is otherwise shown to all users including subscribers and editors (let alone “customers” in a WooCommerce shop, how much confidence does it inspire to have a security warning you probably don’t understand popping up?) and it just pollutes their dashboard.
My 2 cents.
Keep up the good work!
Cheers,
LucaJune 22, 2017 at 12:06 am #337248TomLead DeveloperLead DeveloperInteresting point. The notice only displays in the Dashboard, which is usually reserved for admins, editors etc.. not subscribers. I’ll absolutely add a check in there – thanks for the heads up!
June 22, 2017 at 1:33 pm #337611GideonOk, adding it to the wp-config.php file did do the job.
Thanks
June 22, 2017 at 7:49 pm #337702TomLead DeveloperLead DeveloperAwesome 🙂
June 28, 2017 at 1:59 pm #340964FrancesHi you guys, I hope it’s ok I’m adding a comment to this support topic!
I followed your instructions to add the following code to the “code snippet” plugin. I then saved/activated after checking to be sure ‘run snippet everywhere’ is checked.
When I return to the dashboard the message is gone. However I now have the following characters appearing at the beginning of each page:
‘,’
‘); ?>Quite mysterious!
When I delete the snippet the message comes back and the mysterious characters disappear.
Am I missing a step? Was I supposed to also do something in GP Hooks? (I haven’t)
If I need to add this code to the WP config file, where do I paste it? (sorry – totally green on this stuff!)
add_action( ‘after_setup_theme’, ‘tu_disable_php_in_hooks’ );
function tu_disable_php_in_hooks() {
define( ‘GENERATE_HOOKS_DISALLOW_PHP’, true );
}and then do I then delete the code snippet?
Thanks so much for illuminating me. I appreciate your help!
Cheers,
FrancesJune 28, 2017 at 2:04 pm #340965LeoStaffCustomer SupportDo you have anything added in the GP hooks module?
If not can you link us to the page where this is happening? Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.