Site logo

[Resolved] No solution found for “Unable to execute PHP as DISALLOW_FILE_EDIT”

Home Forums Support [Resolved] No solution found for “Unable to execute PHP as DISALLOW_FILE_EDIT”

Home Forums Support No solution found for “Unable to execute PHP as DISALLOW_FILE_EDIT”

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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.

    #2524749
    David
    Staff
    Customer Support

    Hi 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 ?

    #2524860
    PREMKUMAR S

    I am seeing the warning when creating author box using elements.

    You can see this screenshot: https://prnt.sc/CuSOqciYjlSH

    #2524970
    Ying
    Staff
    Customer Support

    I would recommend using a blcok element to create author box:
    Here’s a video tutorial: https://youtube.com/watch?v=HMhUo91RjsE&si=EnSIkaIECMiOmarE

    If you still want to use PHP code, read this article: https://docs.generatepress.com/article/disallow-php-execution/

    #2525524
    PREMKUMAR 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.

    #2525527
    Fernando
    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?

    #2525618
    PREMKUMAR S

    i am using this exact one, add_filter( ‘generate_hooks_execute_php’, ‘__return_true’ );

    Yes, using child theme

    #2525892
    David
    Staff
    Customer Support

    Can 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 ?

    #2526219
    PREMKUMAR 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’ );

    #2526334
    PREMKUMAR S

    it working amd i will close this thread as solved.

    #2526975
    David
    Staff
    Customer Support

    Glad to hear that

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.