Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Custom Post Type in Multiple Taxonomies

$
0
0

Replies: 0

Greetings! I’m having an issue when a custom post type (in this case, a ‘Business’) is associated with multiple taxonomies (in this case, a ‘Category’ or type of business.

For example, let’s say La Casita Mexican Restaurant is in two categories, “Restaurants” and “Mexican Restaurants”.

Both those categories are custom taxonomies I created within the Pods plugin.

When I try to create a list of available categories (I’ll include my code below), what appears is “Restaurants” and “Mexican Restaurants and Restaurants”, but not “Mexican Restaurants”.

So basically I get the one category alone, and then a strange combination category, but not another single version of the other category. I’m wanting “Mexican Restaurants” as well as “Restaurants”.

Here’s the code I use to pull in available categories:

//Set the parameters of the query
$cat_params = array(
‘orderby’ => ‘business_type.name’,
‘order’ => ‘ASC’,
‘limit’ => 150000,
‘where’ => “business_state.meta_value = ‘$chosen_ST'”
);

$categories = pods( ‘businesses’, $cat_params );

//dump results into arrays
while ( $categories->fetch() ) {

$cat_ids[] = $categories->display( ‘business_type.term_id’ );
$cat_names[] = $categories->display( ‘business_type.name’ );
$cat_slugs[] = $categories->display( ‘business_type.slug’ );
$cat_parents[] = $categories->display( ‘business_type.parent’ );

}

How can I adjust my query to not skip the other category in it’s singular (for lack of a better term) listing?


Viewing all articles
Browse latest Browse all 59525

Trending Articles