0

Today morning I updated my wordpress, everything was fine, but suddenly I came to know that if I click on any post which is not having custom taxonomies selected in it, are giving me 404 pages.

I thought this is due to some plugins, so I deactivated all the plugins, and then I checked, everything was working, then I activated one by one plugin and came to know the actual plugin due to which I was getting 404 is GD Custom Posts And Taxonomies Tools plugin, which I was using for creating custom Taxonomies.

But my other posts were working without 404, so i dig my head more into my wordpress, and came to know that my url structure is not supporting wordpress 3.1

In my permalinks structure, I am using custom taxonomies, which was working fine till wordpress 3.0.5, My permalink structure is this /%postname%/%location%/%mba_courses%/ where location and mba_courses are my custom taxonomies,

To make this work I am using this code:

add_filter('post_link', 'location_permalink', 10, 3);
add_filter('post_type_link', 'location_permalink', 10, 3);
function location_permalink($permalink, $post_id, $leavename) {
    if (strpos($permalink, '%location%') === FALSE) return $permalink;

        // Get post
        $post = get_post($post_id);
        if (!$post) return $permalink;

        // Get taxonomy terms
        $terms = wp_get_object_terms($post->ID, 'location');    
        if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
        else $taxonomy_slug = 'location';

    return str_replace('%location%', $taxonomy_slug, $permalink);
}

add_filter('post_link', 'mba_courses_permalink', 10, 3);
add_filter('post_type_link', 'mba_courses_permalink', 10, 3);

function mba_courses_permalink($permalink, $post_id, $leavename) {
    if (strpos($permalink, '%mba_courses%') === FALSE) return $permalink;

        // Get post
        $post = get_post($post_id);
        if (!$post) return $permalink;

        // Get taxonomy terms
        $terms = wp_get_object_terms($post->ID, 'mba_courses'); 
        if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
        else $taxonomy_slug = 'mba_courses';

    return str_replace('%mba_courses%', $taxonomy_slug, $permalink);
}

How can I make this work in 3.1 or is their any feature in 3.1 where I can have custom taxonomies on my permalink?

0

Why not post it on the dev4press.com forum? They have really good support. Milan is pretty quick to respond too.

I haven't yet tried using my version of this plugin on 3.1. Just GD Press Tools.

  • I discussed with him, but this is not the problem of plugin, this is something wrong with wp, wp 3.1 is not supporting my taxonomies function – Niraj Chauhan Feb 24 '11 at 11:39
  • ohh, well that's .... retarded lol I would've thought that 3.1 would have better support for tax and cpt's. guess not, they added too many other new additions and maybe should've focused better on the older new things. – jaredwilli Feb 24 '11 at 11:47
  • the only solution I found to get rid of this, is to give at-least one custom-taxonomies to each post which were not having before, which were giving me 404, after doing this I am not getting 404, but I had to edit all my posts again. :( with wp3.1 – Niraj Chauhan Feb 24 '11 at 11:57
0

For me it was the Top Level Categories plugin. Bummer too, I like that plugin. Maybe there is another one that is more up to date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.