- This topic has 10 replies, 4 voices, and was last updated 2 years, 8 months ago by
David.
-
AuthorPosts
-
February 7, 2023 at 7:24 am #2524482
PREMKUMAR S
Hello,
I have read all your documentation, but for some reason this message still appears, “Unable to execute PHP as DISALLOW_FILE_EDIT is defined.”
I am unsure what the problem is.
Added this in function php: add_filter( ‘generate_hooks_execute_php’, ‘__return_true’ );
Tried deactivating the security plugin, I use malcare security plugin and also deactivated perfmatters plugin, cleared wp rocket cache.
February 7, 2023 at 9:03 am #2524749David
StaffCustomer SupportHi there,
the
DISALLOW_FILE_EDIT
is something that is normally defined in your wp-config.php
More info on that here:https://docs.generatepress.com/article/disallow-php-execution/
This PHP Snippet only allows you to execute PHP in the GP Hook Element, it has no purpose for anywhere else.
add_filter( 'generate_hooks_execute_php', '__return_true' );
Where are you seeing the warning and what are you wanting to do ?
February 7, 2023 at 10:20 am #2524860PREMKUMAR S
I am seeing the warning when creating author box using elements.
You can see this screenshot: https://prnt.sc/CuSOqciYjlSH
February 7, 2023 at 11:40 am #2524970Ying
StaffCustomer SupportI would recommend using a blcok element to create author box:
Here’s a video tutorial: https://youtube.com/watch?v=HMhUo91RjsE&si=EnSIkaIECMiOmarEIf you still want to use PHP code, read this article: https://docs.generatepress.com/article/disallow-php-execution/
February 8, 2023 at 1:05 am #2525524PREMKUMAR S
I don’t want another plugin to eat my resources and that’s why I’ve bought the generate press theme, and you are pushing me in the bush again.
Pls check my above statement, I have tried everything mentioned in this article: : https://docs.generatepress.com/article/disallow-php-execution/
Still the same problem and I need elements to create many things.
February 8, 2023 at 1:11 am #2525527Fernando Customer Support
Hello there,
Can you check if the function you added in functions.php doesn’t have curved quotation marks? The quotation marks need to be straight.
Example:
add_filter( 'generate_hooks_execute_php', '__return_true' );
Also, to confirm, are you already using a Child theme?
February 8, 2023 at 3:14 am #2525618PREMKUMAR S
i am using this exact one, add_filter( ‘generate_hooks_execute_php’, ‘__return_true’ );
Yes, using child theme
February 8, 2023 at 7:21 am #2525892David
StaffCustomer SupportCan you confirm that this code:
add_filter( 'generate_hooks_execute_php', '__return_true' );
is in your Child Theme > functions.php file ?
And if it is, is there any other code there ?
February 8, 2023 at 9:39 am #2526219PREMKUMAR S
This is the code in child theme funcitons.php
<?php
/**
* Custom function PHP code will goes after it
* /
add_filter( ‘generate_post_date_output’, function( $output, $time_string ) {
$time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>Published on: %2$s</time>’;if ( get_the_date() !== get_the_modified_date() ) {
$time_string = ‘<time class=”entry-date updated-date” datetime=”%3$s” itemprop=”dateModified”>Last Updated on: %4$s</time>’;
}$time_string = sprintf( $time_string,
esc_attr( get_the_date( ‘c’ ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( ‘c’ ) ),
esc_html( get_the_modified_date() )
);return sprintf( ‘<span class=”posted-on”>%s</span> ‘,
$time_string
);
}, 10, 2 );add_filter( ‘generate_hooks_execute_php’, ‘__return_true’ );
February 8, 2023 at 11:44 am #2526334PREMKUMAR S
it working amd i will close this thread as solved.
February 9, 2023 at 3:07 am #2526975David
StaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.