WordPress.org

Ready to get started?Download WordPress

Forums

Custom Taxonomies Not Working in WP 3.1 (11 posts)

  1. Ryan
    Member
    Posted 3 years ago #

    Hi all,
    I just installed WP 3.1 and I notices all of my custom taxonomies no longer function. Has something changed here that I wasn't aware of? Everything was fully functional pre-3.1 up to 3.0.5. Here is how I am registering them...

    `[Code moderated as per the Forum Rules. Please use the pastebin]

  2. grace-pl
    Member
    Posted 3 years ago #

    Same thing is happening to me.

    I have just upgraded to WP 3.1 and my custom taxonomies are no longer behaving correctly.

    1. When I go to click on my custom taxonomy in the admin, I receive the WP 'Cheatin' uh?' Error.

    2. My WPQuery no longer filters to specific taxonomy slugs.

    Registering my custom taxonomy like so:

    add_action( 'init', 'build_taxonomies', 0 );
     function build_taxonomies() {
        register_taxonomy(
    	    'product_Category',
    	    'products',
    	    array(
    	        'hierarchical' => true,
    	        'label' => 'Product Category',
    			'public' => true
    	    )
    	);
    }

    Have been calling my query like so:

    <?php $args = array( 'post_type' => 'products', 'posts_per_page' => 10, 'taxonomy' => 'private-label' ); ?>
    
    				<?php $loop = new WP_Query( $args ); ?>
    				<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    ....etc.....

    Anybody have any ideas what's different about the way WP 3.1 handles custom taxonomies?

  3. Ryan
    Member
    Posted 3 years ago #

    Well, this has got a little more interesting...if I register a post type as follows 3.1 does not show the custom taxonomies...BUT if I just change the name of the registered custom post type it works. Some names seem to work and others fail completely. This seems like a bug unless the name of a custom post type is severely limited by a list that I don't know...If anyone has any ideas I would love to hear.

    I have created a new blank theme (just style.css, index.php and functions.php) to test the custom taxonomy...

    THIS ONE DOES NOT WORK...
    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. Ryan
    Member
    Posted 3 years ago #

    In the previous post all that was changed was this line...

    register_post_type('eTickets', $args);

  5. Ryan
    Member
    Posted 3 years ago #

    UPDATE: It seems you can't use any capital letters in a custom taxonomy name...just be aware...

  6. grace-pl
    Member
    Posted 3 years ago #

    Thanks for the capital letter tip!

    Changing my taxonomy name to be lowercase both of my issues.

    Unfortunately though, in changing the original taxonomy name, it broke my nav_menu set up that was using the same taxonomy, giving me this error:
    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/---/---/wp-includes/formatting.php on line 445

    Have investigated: this is a bug. Apparently it happens any time you change your custom taxonomy name. Some people had success deleting certain things in phpmyadmin. I decided to a fresh install.

    Now everything is back to normal (minus some content that I now need to re-enter) and working perfectly.

    Good luck!

  7. Ryan
    Member
    Posted 3 years ago #

    Glad to hear that worked out. I tried to enter a ticket into the bug tracking but they deleted it. I am sure it is somewhere in the codex but it wasn't at all clear at first.

  8. drudarby
    Member
    Posted 3 years ago #

    Just a note - I just discovered that it also cannot contain any spaces!

  9. jhob
    Member
    Posted 2 years ago #

    This thread just saved me a lot a of pain when I ran into that error - thanks!

  10. guldi
    Member
    Posted 2 years ago #

    thx!

  11. jmoverpeck
    Member
    Posted 2 years ago #

    Yes, thanks a lot for sharing. Saved me some trouble.

    Although the "Cheatin' huh" error was cute and made me smile, it really was less than helpful as an error message.

Topic Closed

This topic has been closed to new replies.

About this Topic