WordPress.org

Forums

WordPress SEO by Yoast
Breadcrumbs function exists even if toggled off (6 posts)

  1. BackuPs
    Member
    Posted 1 year ago #

    Hi yoast,

    i think i found a issue with this function. It worked nicely before but it does not now anymore due to code changes in your plugin.

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

    still exists even if i turn off the breadcrumbs in your setting causing my own theme breadcrumbs to fail.

    pls can you load the function only when the option is activated like you did before in previous versions.

    Thanks

    https://wordpress.org/plugins/wordpress-seo/

  2. BackuPs
    Member
    Posted 1 year ago #

    Code should be now

    <?php if ( function_exists('yoast_breadcrumb') ) {
          $yoast_links_options = get_option( 'wpseo_internallinks' );
          $yoast_bc_enabled=$yoast_links_options['breadcrumbs-enable'];
          if ($yoast_bc_enabled) {
                   yoast_breadcrumb('<p id="breadcrumbs">','</p>');
          } else {
             //your own breadcrumbscode;
          }
    } ?>
    

    Best regards

  3. BackuPs
    Member
    Posted 1 year ago #

    I think the problem is caused by this ability which has been added to your plugin.

    function wpseo_shortcode_yoast_breadcrumb() {
    	return yoast_breadcrumb( '', '', false );
    }
    add_shortcode( 'wpseo_breadcrumb', 'wpseo_shortcode_yoast_breadcrumb' );
    
  4. jrf
    Member
    Posted 1 year ago #

    Please look here for more information on this: https://github.com/Yoast/wordpress-seo/issues/795.

  5. BackuPs
    Member
    Posted 1 year ago #

    Hi

    Thanks for the feedback i wonder why i need the extra info though as you can see from above code we have a similar solution. I prefer the function check exists and then the option check method and not run the breadcrumbs call and check if the return is empty.

    This way i can avoid the array check and calling a option that might (even if the plugin is turned off) or not might exists if the plugin is or not is running anymore.

    Thanks anyway i will post on github next time.

  6. jrf
    Member
    Posted 1 year ago #

    Glad you found a solution which suits you.

    Please be aware GitHub is only for bug report NOT for support.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress SEO by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic