Custom Fields
Re-Envisioned
Support MB Custom Taxonomy Insert multiple posts into one custom category

  • Creator
    Topic
  • #17054
    Nuno Cruz
    Participant

    How to insert a custom post into a custom category?

    $post_data = array(
                'post_title' => '...',
                'post_content' => '...',
                'post_type' => 'my-post-type',
                'post_status'   => 'publish',
                'post_author'   => 1,
                'tax_input' => array(
                    'my-custon-category' => array( $my_id )
                )
            );
            $post_id = wp_insert_post( $post_data, true);
  • You must be logged in to reply to this topic.