• Hi,

    WordPress stopped using a slug and I can’t figure out why. It just stopped. I can change the slug to other things, and its fine. But it won’t use the original slug.

    Here’s the deal…

    I have post type called ‘event_listing’ and a taxonomy called ‘event_type’ .

    event_type slug: ‘rewrite’ => array( ‘slug’ => ‘events’),

    event_listing slug: ‘rewrite’ => array(‘slug’ => ‘events/%event_type%’),

    Thing to filter /%event_type%/ (though i would like a better way to filter this, so i can use it on other post types, so if someone has better one, fire away):

    <?php function filter_post_type_link($link, $post)
    {
        if ($post->post_type != 'event_listing')
            return $link;
    
        if ($cats = get_the_terms($post->ID, 'event_type'))
            $link = str_replace('%event_type%', array_pop($cats)->slug, $link);
        return $link;
    }
    add_filter('post_type_link', 'filter_post_type_link', 10, 2);?>

    Results: 404 error, but ONLY if I set the taxonomy slug to events, if i change it to: ‘eventssss’, or ‘event_type’, or ‘moo’ or ‘wtf’ …its fine. I have no pages named ‘events’ there’s nothing my database that comes up as ‘events’ I’ve flushed my permalinks, I’ve restarted my local.

    Ideas on what is going on? I don’t get it at this point.

    Thanks

    Nadine

  • The topic ‘wordpress stopped recognizing a slug’ is closed to new replies.