golaz
golaz

Reputation: 71

Post category in wordpress

Hy,

How use post_category for all category and subcategory in wordpress in wp_insert_post?

Thx for answers.

Upvotes: 0

Views: 48

Answers (1)

Banago
Banago

Reputation: 1420

Like an array:

$query = new WP_Query( array( 'category_name' => 'category-name' ) );
while( $query->have_posts() ); $query->the_post();

      //show your post here.

endwhile;

Upvotes: 1

Related Questions