WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. BackuPs
    Member
    Posted 5 months 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 5 months 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 5 months 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 5 months ago #

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

  5. BackuPs
    Member
    Posted 5 months 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 5 months ago #

    Glad you found a solution which suits you.

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

Reply

You must log in to post.

About this Plugin

About this Topic