Site logo

[Support request] DISALLOW_FILE_EDIT’, true ); PHP hook

Home Forums Support [Support request] DISALLOW_FILE_EDIT’, true ); PHP hook

Home Forums Support DISALLOW_FILE_EDIT’, true ); PHP hook

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2497340
    Matt

    I’m using a breadcrumb plugin and hook element to execute the following.

    I had this in my wp-config.pho file and it was preventing the above element from running.

    (‘DISALLOW_FILE_EDIT’, ‘true’);

    Is there a fix or a workaround for this?

    #2497375
    David
    Staff
    Customer Support

    Hi there,

    a few options

    1. set that filter to false and allow file editing from the admin screen.

    2. use the code snippet from the following doc to just enable PHP editing in GP Hooks:

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

    3. use a PHP function instead to add the breadcrumb:

    https://docs.generatepress.com/article/adding-breadcrumbs/#using-functions

    #2497388
    Matt

    Not understanding.

    3. Hook element is what I’m using.

    #2497409
    David
    Staff
    Customer Support

    3. is the Using Functions method in that doc:

    https://www.screencast.com/t/YgOf4Vj4fC1

    You don’t use a GP Hook Element.
    You would add the code using one of the methods provided here:

    https://docs.generatepress.com/article/adding-php/

    TLDR: Are you using a Child Theme?
    If Yes, then that code goes in your Child Theme functions.php
    If No, then install the Code Snippets plugin ( link in the doc above ) and add the code to a new snippet.

    This method also applies to option 2

    #2497420
    Matt

    It is not a child theme.

    If I use the code snippet plugin how do I exclude certain posts? With the hook element, I can choose to display only on posts and exclude certain posts.

    #2497430
    David
    Staff
    Customer Support

    Do you use the Block Editor ?

    If Yes, you can create a Block Element instead, and add the Yoast Breadcrumb Block.

    #2497439
    Matt

    Appearance -> Elements -> is how I created it.

    Again… MY issue is I had to comment out the line below in my wp-config.php for the element to work.

    (‘DISALLOW_FILE_EDIT’, ‘true’);

    #2497453
    Matt

    Also I’m using the Breadcrumb NavXT plugin not yoast.

    #2497459
    David
    Staff
    Customer Support

    1. Add new Code Snippet
    1.1 Add this code to your snippet:

    add_filter( 'generate_hooks_execute_php', '__return_true' );

    1.2 Save the Snippet.

    2. Then create your GP Hook Element. You will now be able to Check Execute PHP.

    #2497495
    Matt

    Thanks. That worked.

    #2497652
    David
    Staff
    Customer Support

    You’re welcome

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