amarinediary / WordPress-simple-URL-based-breadcrumb

🍞 A non-invasive WordPress unofficial plugin, minimalist and SEO friendly. both lightweight and lightning fast, adding URL based breadcrumb support. Plug-and-play, with no required configuration.
https://stackoverflow.com/a/67453887/3645650
Creative Commons Zero v1.0 Universal
27 stars 5 forks source link

Bug with custom post type slug #11

Closed nikolailehbrink closed 2 years ago

nikolailehbrink commented 2 years ago

Hi there again. I just noticed something strange. I registered a custom post type with:

'rewrite' => array(
    'slug' => 'team',
    'with_front' => false
)

When I open the /team site the breadcrumb only shows the first homepage as a link of "Start" instead of "Start → Team". I set the start node with:

<?php
    $ingredients = array(
        'separator' => '→',
        'root' => array(
            'slug' => 'Start',
            'url' => get_home_url(),
        ),
    );
    the_bread($ingredients);
?>

In all other cases, when no cpt is registered with a slug, it works fine.

amarinediary commented 2 years ago

Indeed, I see what you mean... The initial idea was to filter out taxonomies and post types because WordPress doesn't generate an index for them, meaning, that mywebsite.com/taxonomy would redirect to a 404.php. Same goes for post types, except if you're using an archive page. As I wasn't using one at the time of the initial development I didn't noticed the issue. The fix is pretty straight forward, I will remove the post type filtering and push the new update 1.2.2 during the day.

amarinediary commented 2 years ago

Current plugin version: 1.2.2

1.2.2