get_posts wont produce a list of custom type from a given category [duplicate]

I’m assuming ‘news_category’ is a custom taxonomy; if not, and if you have simply created a new post category called ‘news_category’, it will only work if you add support to your custom post type. Be aware though that this will add complexities to your feeds and queries, as well as affecting how category posts show … Read more

Custom post categories are not displaying on the page

$args = array( ‘post_type’ => ‘travelplan’, ‘numberposts’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘travelplan_cat’, ‘field’ => ‘slug’, ‘terms’ => ‘testtravel’ ) ) ); $plans = get_posts( $args ); echo ‘<pre>’; print_r($plans); echo ‘</pre>’; Change your register_taxonomy like this function create_travelPlan_taxonomy() { register_taxonomy( ‘travelplan_cat’, ‘travelplan’, array( ‘label’ => __( ‘Category’ ), ‘rewrite’ => array( … Read more

Rewrite/Change custom taxonomy slug

Try using the below code to overwrite arguments of already registered taxonomies. function wp_modify_taxonomy() { // get the arguments of the already-registered taxonomy $custom_category_args = get_taxonomy( ‘genre’ ); // make changes to the args $custom_category_args->rewrite[‘slug’] = ‘chambers’; $custom_category_args->rewrite[‘with_front’] = false; // re-register the taxonomy register_taxonomy( ‘genre’, ‘chambers’, (array) $custom_category_args ); } add_action( ‘init’, ‘wp_modify_taxonomy’, 11 … Read more