Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
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 –  ntechi 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 –  ntechi Feb 24 '11 at 11:57

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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