• Hi,

    I can’t add a category when i create a new post (in development).

    I use template with custom post named “artist” and use taxonomy “artist category” and i use this code for add a new post :

    $newPost = array(
              'post_title'    => $user->nickname,
              'post_content'  => $user->description,
              'post_status'   => 'pending',
              'post_author'   => $userID,
              'post_type'     => 'cpt_artists',
              'tax_input' => array(
                    'category' => array(
                        'dj'
                    )
            ));

    But it’s not working … ??

    Do you have an idea ? Thanks

    [ Please do not bump, that’s not permitted here. ]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pixel016

    (@pixel016)

    I try to use wp_set_object_terms( $post_id, 'dj', 'artist-category',false); but not working

    Thread Starter pixel016

    (@pixel016)

    And when i list all the taxonomies i have this in the log file :

    [22-Jan-2014 16:25:04 UTC] <p>category</p>
    [22-Jan-2014 16:25:04 UTC] <p>post_tag</p>
    [22-Jan-2014 16:25:04 UTC] <p>nav_menu</p>
    [22-Jan-2014 16:25:04 UTC] <p>link_category</p>
    [22-Jan-2014 16:25:04 UTC] <p>post_format</p>

    Why i don’t have my custom taxonomy “artist-category” here ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add post category (taxonomy) in wp_insert_post’ is closed to new replies.