WordPress.org

Ready to get started?Download WordPress

Forums

wp_set_object_terms problem (3 posts)

  1. btray1977
    Member
    Posted 3 years ago #

    I'm using custom taxonomies to create a taxonomy called 'catalog'. In this I'm programmically inserting the terms. The terms do not show up in the admin unless I edit the terms manually in the admin.

    This also affects the end user when going to website.com/catalog/{term name goes here} when it has no items in it (child terms may have items in them). It gives me a 404 error. As soon as I edit the terms in the admin manually there is no more 404 error issue.

    example code of what I'm using:
    $category = array('one','two','three','four');

    foreach ( $category as $cat )
    {
    $categoryname[] = get_term( $cat, 'catalog' );
    }
    foreach ( $categoryname as $cat )
    {
    $term_id = wp_set_object_terms( $postID, $cat->slug, 'catalog', false );
    }

    Screen grab of admin showing problem. Notice drop down list has all items, but list does not.

    http://i30.tinypic.com/s49nav.jpg

  2. zagriyen
    Member
    Posted 3 years ago #

    same for me, i want add terms to a specific taxonomy and assign this terms to a post_id

  3. btray1977
    Member
    Posted 3 years ago #

    Zagriyen look at: http://pastebin.com/94Vbp1DZ It's a demo on how to make terms.

    This still has problems, but should let you see how to do it. To see the problems look at: http://wordpress.org/support/topic/taxonomy-problems and if you find a fix please let me know!

    -Brad

Topic Closed

This topic has been closed to new replies.

About this Topic