Form to custom post type and custom taxonomy

Use WP set object terms $new_post = array( ‘post_title’ => $title, ‘post_content’ => $description, ‘tags_input’ => array($tags), ‘post_address’ => array($address), ‘post_status’ => ‘draft’, // Choose: publish, preview, future, draft, etc. ‘post_type’ => ‘trademen’ //’post’,page’ or use a custom post type if you want to ); //save the new post $pid = wp_insert_post($new_post); wp_set_object_terms( $pid, $industry, … Read more

Displaying posts from a custom category

The documentation for WP_Query is the place to look for this 🙂 In particular, you’re after the taxonomy query parameters. Adding a tax_query to your code will look like this: $rate_query = new WP_Query( array ( ‘post_type’ => ‘movies’, ‘posts_per_page’=>’5’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘movie_genre’, ‘field’ => ‘slug’, ‘terms’ => array( ‘movie-genre-2’ ), … Read more