30 posts
  • Microlancer Beta Tester
  • Elite Author
  • Exclusive Author
  • Thailand
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 10 and 49 users
madza says

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

3365 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

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

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Surely you should use an array for including multiple taxonomies in your query.

30 posts
  • Microlancer Beta Tester
  • Elite Author
  • Exclusive Author
  • Thailand
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 10 and 49 users
madza says

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!

58 posts
  • Bought between 10 and 49 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Sold between 100 000 and 250 000 dollars
DigitalCavalry says

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'))));
30 posts
  • Microlancer Beta Tester
  • Elite Author
  • Exclusive Author
  • Thailand
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 10 and 49 users
madza says

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

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Dunno why people use WP_Query. Using query_posts is far easier to implement.

1383 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Serbia
wpCanyonThemes says

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 .

30 posts
  • Microlancer Beta Tester
  • Elite Author
  • Exclusive Author
  • Thailand
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 10 and 49 users
madza says

For me query_posts work similar! Can’t get out with space!

30 posts
  • Microlancer Beta Tester
  • Elite Author
  • Exclusive Author
  • Thailand
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 10 and 49 users
madza says

I found a solution, thank you all!

by
by
by
by
by
by