• Resolved nevrsmer

    (@nevrsmer)


    Hi,

    I’d love to use Yoast Breadcrumbs and keep our site safe at the same time.

    In the wp-config.php file, we have the following code: define(‘DISALLOW_FILE_EDIT’, true); to disable the file editor.

    When set to “true” to disable the file editor, Yoast Breadcrumbs does not function. When it’s set to “false”, enabling the file editor, Yoast Breadcrumbs works.

    Is their a way to create an exception to this rule for Yoast Breadcrumbs? Or, is there another way to implement Yoast Breadcrumbs that will circumvent this issue?

    We are using the most recent version of GeneratePress Pro and Yoast.

    Thank you and have a good day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @nevrsmer,

    You mentioned that the Yoast breadcrumbs don’t appear when you set DISALLOW_FILE_EDIT to false. This is strange because the feature doesn’t require it.

    Can you check to see if there are any other theme or plugin conflicts causing this problem? We have a step-by-step guide here:?How to check for plugin conflicts.

    Also, can you give us more information about how you implemented the breadcrumbs? Did you add the code to your theme files or using a hook somewhere else?

    Thread Starter nevrsmer

    (@nevrsmer)

    Response to Yoast

    Hello Priscilla,

    Thanks for the quick response!

    Please know I am not a programmer, coder, or developer. As such, I rely heavily on tutorials and support form experts such as yourself to develop our site. So, please keep this in mind when asking questions and providing solutions.

    Clarification: If I remove the entire line “define(‘DISALLOW_FILE_EDIT’, false);” from the wp-config.php file in the public_html directory, using a hook element in GeneratePress Pro allows Yoast Breadcrumbs (YB)to function. I mistakenly stated that if I set it to “true” that YB would work. My apologies.

    All of our plugins are up to date and there are no plugin conflicts. Thanks for sending How to Check for Plugin Conflicts Guide.

    All of our plugins are up to date. The site is built primarily with GeneratePress Pro with GP’s child theme and GenerateBlocks. We are not using a page builder. It is a site that is in development, so it’s a fresh install of WordPress, and all the plugins have been installed within the past month and have been updated as soon as a new version is available.

    We configured YB based on the information provided in these guides:

    1. https://yoast.com/help/implement-wordpress-seo-breadcrumbs/

    2. https://docs.generatepress.com/article/adding-breadcrumbs/

    Steps:

    1. Create a Hook Element in Generate Press
    2. Set hook to: after_entry_title
    3. Set display rules to: Entire site (Just to make sure it was displaying and will refine to select posts later)
    4. Enabled the option Execute Short Codes
    5. Pasted the code below in the field for code
    6. Updated the hook element
    7. Enabled Yoast Breadcrumbs

    ‘<?php
    if ( function_exists(‘yoast_breadcrumb’) ) {
    yoast_breadcrumb( ‘<p id=”breadcrumbs”>’,'</p>’ );
    }
    ?>’

    Notes: I noticed that when creating this hook element, that in the Execute PHP option, it showed: Unable to execute PHP as DISALLOW_FILE_EDIT is defined. I ignored this as I was using the short code option.

    8. Went to a post to verify if working. Instead of breadcrumbs, this appeared on posts: ‘,’
    ‘ ); } ?>

    In looking for a resolution, I found a support topic on GeneratePress in which the issue regarding DISALLOW_FILE_EDIT in the wp-config.php file is mentioned by. For a GP user, it was the cause of YBC not working

    GP Support Topic: https://generatepress.com/forums/topic/install-yoast-breadcrumbs/

    If set to “true” the Theme Editor in Appearance is not available. If set to false, it is available. In either case, YB did not work. So, out of curiosity, I removed the entire line of code – define( ‘DISALLOW_FILE_EDIT’, true );
    – from the wp-config.php file, and Yoast Breadcrumbs works. This also makes the Execute PHP option hook element in GP available. By removing it, however, the Theme Editor is available in the dashboard and is a security vulnerability.

    I also tried another way to implement YB as explained in the section “Using Functions” in this GP Article: https://docs.generatepress.com/article/adding-breadcrumbs/. (I trashed the GP hook element beforehand). This method works even with DISALLOW_FILE_EDIT’ in place (it looks like that rule is not applied to it).

    After reading this, what are your recommendations in order to use the hook element?

    Thank you very much for your time and have a good day!

    Thread Starter nevrsmer

    (@nevrsmer)

    Hello Priscilla,

    I figured it out. I made a novice mistake. I needed to input the short code in the hook element, not the PHP code.

    Sorry for the bother.

    On another note, I do have another question about breadcrumbs if you have a moment.

    Also, is it possible to change the name of the category in the breadcrumbs and not change the title of the category, which is the H1? It’s just too long, and for mobile, it’s ridiculously long. They want you to use descriptive titles for user experience and SEO, but then they look horrible in breadcrumbs.

    Current Breadcrumb: Home > Costa Rica Wedding Photography > Post Name

    Change to: Home > Gallery

    From what I understand, GP adds information to the title of posts when using the Title Field that’s beneficial for SEO. I know I can change the category title to “Gallery” and have it not appear on the category page, and then create a more descriptive H1 on the category page itself, but this is not the best solution from what I gather.

    Again, sorry for the bother and have a good day.

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    We are afraid to say that there’s no option available in the Yoast SEO plugin to edit the category title in the breadcrumb path. However, we do have a few filters available that you can use to customize the breadcrumb path based on your needs. You can find them here.

    Thread Starter nevrsmer

    (@nevrsmer)

    Hello Mazedul,

    Thanks for your reply.

    In researching this yesterday, I discovered there indeed is a way to customize the category and post title that appears in Yoast Breadcrumbs.

    In the Yoas SEO section when editing a category or post – it’s located near the bottom (Posts > Categories > Edit (Select the category you want to edit) > Yoast SEO > Advanced > Breadcrumbs Name. In the corresponding field, you can input the name you want to appear in the breadcrumbs for that specific category. It’s the same for posts. In the above patch, just change “Categories” with “Posts”.

    This way, you can have descriptive SEO-optimized category and posts titles, and truncated category and post titles in breadcrumbs.

    Have a good day.

    Cheers!

    • This reply was modified 4 years, 4 months ago by nevrsmer.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Yoast Breadcrumbs – Create Exception in wp-config.php?’ is closed to new replies.