35 posts
  • Has sold $250,000+ on Envato Market
  • Has referred 10+ members
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+4 more
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

3503 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark 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

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

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

35 posts
  • Has sold $250,000+ on Envato Market
  • Has referred 10+ members
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+4 more
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
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
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'))));
35 posts
  • Has sold $250,000+ on Envato Market
  • Has referred 10+ members
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+4 more
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

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

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

1383 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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 .

35 posts
  • Has sold $250,000+ on Envato Market
  • Has referred 10+ members
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+4 more
madza says

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

35 posts
  • Has sold $250,000+ on Envato Market
  • Has referred 10+ members
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+4 more
madza says

I found a solution, thank you all!

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by