[Support request] "Posts" pages give php error

Home Forums Support [Support request] "Posts" pages give php error

Home Forums Support "Posts" pages give php error

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1179162
    Tijn

    For some reason the blogposts give php error.

    I debugged it with deactivating plugins and changing themes. When I deactivate GP Premium plugin. Problem is fixed. But styling is than not correct anymore.

    #1179164
    Leo
    Staff
    Customer Support

    Hi there,

    I don’t believe this would be a GP Premium issue.

    Have you added any header or hooks elements?
    https://docs.generatepress.com/article/header-element-overview/
    https://docs.generatepress.com/article/hooks-element-overview/

    If so what happens if you disable them?

    Let me know ๐Ÿ™‚

    #1179343
    Tijn

    Hi Leo,

    Thanks! Thats correct. It has to do with the Custom Post Header it seems. But I haven’t edited it myself. Is there a way to fix this, or could you see what’s wrong with the code?

    <?php

    $img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘large’, false );
    $categories = get_the_category();
    if ( ! empty( $categories ) ) {
    $cat_name = esc_html( $categories[0]->name );
    }
    global $post

    ?>

    <h1><?php echo get_the_title($post->ID);?></h1>
    <?php echo ‘term_id ) ) . ‘”>’ . esc_html( $categories[0]->name ) . ‘‘; ?>
    <?php echo ‘‘; ?>
    #1179502
    David
    Staff
    Customer Support

    Hi there,

    so this is the reason that script is not firing:

    https://docs.generatepress.com/article/disallow-php-execution/

    Which may be your default wp-config or something a security plugin has added.

    If you want you can overcome this to allow PHP to be executed in GP Hooks only using the snippet provided here:

    https://docs.generatepress.com/article/generate_hooks_execute_php/

    #1180337
    Tijn

    Hi David,

    Thanks for this. Learned a lot again. It’s indeed correct that the define( ‘DISALLOW_FILE_EDIT’, true ); was activated by the security plugin iThemes. I deleted this constant and after re-updating the Element it works again. But without the security measurement. The snippet doesn’t seems to work together with the disallow file edit.

    – I added the snippet using the Cope Snippits plugin, no changes
    – I added the snippet in wp-config.php -> blank page

    Could you maybe suggest some other solutions?

    For now it works again. Thanks!

    Best, Tijn

    #1180445
    David
    Staff
    Customer Support

    So if you re-enable the iThemes security constant ( so the element breaks )
    And add this to Code Snippets:
    https://docs.generatepress.com/article/generate_hooks_execute_php/

    Does it still not work ?

    #1180533
    Tijn

    Yes it works now.

    But I first had to add the Cope Snippet and activate it before re-enabling the iThemes security plugin + constant. Otherwise it doesn’t got it.

    Thanks for all the help!

    #1180640
    David
    Staff
    Customer Support

    Aah right – i suppose thats good security ๐Ÿ™‚ Thanks for letting us know.

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