Hi,
I can’t get some cat from custom post!
WP_Query( array('post_type' => 'portfolio', 'portfolio_taxonomy' => 'Web, LogoWork, Other Work'));
I get only Web and LogoWork but Other Work is missing
What I do wrong?
Thanks You! madza
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Perhaps if you run the query that way you need to use term slugs rather than term names? That might explain why the term with the space isn’t returning.
You may also want to read up here: http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters
- Attended a Community Meetup
- Author was Featured
- Beta Tester
- Bought between 10 and 49 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 3-4 years
- Interviewed on the Envato Notes blog
Surely you should use an array for including multiple taxonomies in your query.
Thanks You,
I do something wrong but I don’t see what. It’s not work for me. Maybe someone can show me more?
I check link for taxonomy parameters and make this:
new WP_Query( array('post_type' => 'portfolio', 'tax_query' => array( array( 'taxonomy' => 'portfolio_taxonomy', 'field' => 'slug', 'terms' => array('Web', 'LogoWork', 'Other Work')))));
The same problem!
madza said
Thanks You,I do something wrong but I don’t see what. It’s not work for me. Maybe someone can show me more?
I check link for taxonomy parameters and make this:
new WP_Query( array('post_type' => 'portfolio', 'tax_query' => array( array( 'taxonomy' => 'portfolio_taxonomy', 'field' => 'slug', 'terms' => array('Web', 'LogoWork', 'Other Work')))));The same problem!
Check the operator value, possible that in default is set to AND , so queried post must be associated with all portfolio categories you have typed in query. Change to this and try.
new WP_Query( array('post_type' => 'portfolio', 'tax_query' => array( array( 'taxonomy' => 'portfolio_taxonomy', 'field' => 'slug', 'terms' => array('Web', 'LogoWork', 'Other Work'), 'operator' => 'IN'))));Thank You, I tried! But same problem!
It’s showed only first taxonomy and not show category with space!
Maybe that is WordPress bug!
Or maybe someone knows other way how to get out from custom post necessary category with space?
Thanks!
madza
- Attended a Community Meetup
- Author was Featured
- Beta Tester
- Bought between 10 and 49 items
- Contributed a Tutorial to a Tuts+ Site
- Exclusive Author
- Has been a member for 3-4 years
- Interviewed on the Envato Notes blog
Dunno why people use WP_Query. Using query_posts is far easier to implement.
ThemeProvince said
Dunno why people use WP_Query. Using query_posts is far easier to implement.
query_posts should be used to change the main loop ONLY .
For me query_posts work similar! Can’t get out with space!
I found a solution, thank you all!
