The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
31 views

tax_query not working for taxonomy slug

i have one custom post type 'game' and one custom taxonomy 'console', which is shared by 'game' and 'post'. Now I created a new PHP 'taxonomy-console' and I want to separately display posts from ...
0
votes
3answers
1k views

Ordering Posts with Custom Taxonomy Terms Array

I can't get the order of my posts (organized by custom tax terms) to come out right in my loop. I made a custom post type of 'staff', in staff there is a custom taxonomy of 'staff-title'. I added ...
0
votes
1answer
11 views

tax_query not working

I have tried using the id, slug, name, and take the tax_query as an array of arrays but still it will output all the posts from that post type. Here's my custom taxonomy, 'Event Specific': function ...
2
votes
2answers
1k views

Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request

This is my first attempt at modifying the main query using the pre_get_posts action/filter This is the function currently hooked to it: function advanced_product_search_filter($query) { ...
0
votes
0answers
38 views

Query breaking with 'posts_per_page' => -1

I'm trying to return all posts for a category associated with a custom post type. I have the following query: $cat_name = single_cat_title('', FALSE); $termObj = get_term_by('name', $cat_name, ...
0
votes
0answers
15 views

Tax Query not generating correct query [duplicate]

I have the following query setup to pull videos from a custom post type by category: $cat_name = single_cat_title('', FALSE); $videos = new WP_Query(array( 'post_type' => 'video', ...
0
votes
1answer
1k views

WP_Tax_Query with post_tag not working

Using the pre_get_posts hook, I'm trying to allow users to narrow down their search by limiting it to posts with certain (multiple) tags applied. This is my hook and function: ...
0
votes
0answers
19 views

Get posts from multiple post types and exclude posts of specific post type by `tax_query`

get_posts( array( 'posts_per_page' => 10, 'post_type' => array( 'post_type_1', 'post_type_2', ), 'tax_query' => array( array( ...
1
vote
0answers
25 views

Custom Taxonomy: show one or the other term [duplicate]

I have registered a taxonomy called location - I have then created a taxonomy file called taxonomy-location.php which is fine and returns all the terms within that taxonomy. Say I have a 2 terms one ...
0
votes
1answer
56 views

Extending WP Query: Custom geolocation meta values work, but tax_query breaks

I've built a custom query for geolocation searches. I'm saving lat and lng within each custom post type as a meta value. My query extension returns results successfully when lat and lng are the only ...
0
votes
0answers
36 views

Remove custom post type from specific page

I have a situation where I am trying to remove a specific custom post type (a portfolio type item) from a certain page. I was able to remove the specific category I want to hide from appearing ...
0
votes
1answer
36 views

How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts

Scenario I am using a complex, awesomely crafted tax query to get up to 4 related posts, first going by tag, then by category if there are not enough posts in tag-related query. This was finely ...
0
votes
2answers
41 views

Dynamically tax_query terms

To display all the categories name with checkbox from custom taxonomy called ct_category I have the following code: $terms = get_terms('ct_category'); foreach ( $terms as $term ) { echo '<li ...
1
vote
1answer
109 views

How to tax query X number of posts related by tag first, then by category if not enough in tag-related

Question How to output tag related posts first, then IF there are less than 4 tag related posts, fill the rest of the 4 spots with category related posts? Scenario Sometimes a post has very few ...
0
votes
1answer
46 views

tax query shortcode

Configuring my shortcode with tax query is proving dificult. When i omit the params for taxonomy/terms i get nothing back. This returns 1 post back as expected [loop post_type="website" ...
0
votes
0answers
46 views

Empty 'terms' in 'tax_query' returns an empty array

I would like a simple search on the products page, so I built a custom WP_Query. $args = array( 'post_type' => 'products', 'meta_key' => 'product_price', 'meta_value' ...
3
votes
1answer
157 views

Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)

I have series of sorting issues on a page that I'm trying to figure out but so far to no avail. Sorting a list of CPT posts which are listed under associated custom taxonomy terms I found this piece ...
0
votes
0answers
46 views

List of CPT posts listed under associated custom taxonomy terms only displays 10 posts per term - how to change/remove limit?

I have some code which displays a list of posts based associated terms like this: Term 1 Post 1 Post 2 Post 3 Term 2 Post 4 Post 5 Post 6 And so on. And it does the job to an extent. A few of ...
0
votes
0answers
22 views

Multi operator in tax_query

I have this code /* TERMS 1 = "ASUS" 2 = "GIGABYTE" 33 = "1151" */ I'm and using query post to get data "tax_query" => array( array( "taxonomy" => "product_cat", ...
0
votes
0answers
30 views

Custom query for tag and custom tag from 2 post type

I have custom post type called items and added custom taxonomies type and sub-type. I like to query posts from both post and items post type that has art as either Tags or Sub type. Below is what ...
0
votes
2answers
193 views

How to restrict search on a certain page to only return results against custom taxonomies?

On a specific page, I would like the search to be performed only against the terms from two custom taxonomies. Not the content or title. That is, the user is directly searching taxonomy terms. What ...
2
votes
1answer
489 views

Query set using tax_query with relation 'OR' modifies category object?

(Update: Please see the edits far below.) The code: function itsme_better_editions( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( ...
0
votes
1answer
159 views

How to add autocomplete to custom taxonomy for CPT

I was following this tutorial, http://gabrieleromanato.name/adding-jquery-ui-autocomplete-to-the-wordpress-search-form/ and have it working like that fine. However, I am attempting to make this ...
1
vote
1answer
520 views

in_category() and tax_query with custom post type

I'm using custom post type, that i have named "products" For this post type i have add the custom taxonomies, that have name "products_brand" There are two terms in it now: "natige" and "osakarovka" ...
0
votes
0answers
47 views

WP_Query: Meta_Query with serialized value (or a workaround)

I have a post type Issue, that has meta values in form of associative arrays (that are saved as serialized strings to database). They look somewhat similar to this: [article_reviews] => Array ...
7
votes
2answers
7k views

Multiple relationship for multiple tax_query in WP_Query

I want to use the WP_Query() class to filter some of my posts. The problem I am facing now is handling the taxonomy query. Normally, the WP_Query() only handle one relationship for tax_query() (either ...
0
votes
0answers
45 views

Multiple tax_queries: display posts titles from several custom taxonomie

Im trying to get this work. They do individually. function render_main_menu (){ $cpt = 'mycpt'; $tax = 'section'; $term = 'main'; $tax2 = 'paragraph'; $term2 = 'sub'; $loop = ...
0
votes
2answers
166 views

if wp_query taxonomy term have posts

Having formulated my $query for a custom taxonomy on a page template, how would I ask if a specific term has posts? $args = array( 'post_type' => 'exhibitions', 'tax_query' => array( ...
0
votes
1answer
27 views

How to get hierarchical number of custom taxanomy

I have custom taxonomy some thing like : Item - A Item A-1 Item A-2 Item A-2-1 Item A-2-2 Now i want to get what is the number of hierarchical number of Item A-2, if we start from 0 it ...
8
votes
2answers
15k views

Nested meta_query with multiple relation keys

I am curious whether Wordpress is able to run nested meta_query, with each having different relation keys? As of Wordpress 3.0, tax_query is able to perform this function; I'm wondering whether this ...
0
votes
0answers
64 views

Is there a good way to get all queried taxonomy terms?

For most cases, getting the queried taxonomy term is as simple as calling get_queried_object(), but I have noticed that if multiple taxonomy terms are queried, that function only returns one of them. ...
0
votes
0answers
29 views

Secondary ordering and order DESC not working when using meta_value_num

I have this query: $args_members = array( 'posts_per_page' => -1, 'post_type' => 'team_member', 'post_status' => 'publish', 'meta_key' => ...
0
votes
0answers
56 views

WP_Query relation AND with two taxonomies and orderby rand, prioritising one taxonomy

I have a wp_query which selects posts from a CPT, using relation AND to select posts from two taxonomies (sector and expertise). I would like the order of posts returned to be random but I would still ...
0
votes
1answer
257 views

Empty tax_query array returns an empty array

I would like to return all posts when the tax_query['terms'] is empty. $args = array( 'post_type' => 'product', 'posts_per_page' => 15, 'paged' => $paged, ...
1
vote
2answers
1k views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
0
votes
0answers
33 views

Filter search result by either a taxonomy1, or a taxonymy2, or both taxonomy1 and taxonomy2

I'm trying to build a search site for non-profit website, where dog owners can find restaurants (in selected city and with selected cuisine type) where they will be let in with their dog. The problem ...
0
votes
1answer
270 views

Using tax_query to get single post per category

I have a list of magazines I need to categorize and sort. I have created a custom post type and registered a custom taxonomy to organize them. Category Structure: Print Magazines (parent category) ...
0
votes
1answer
121 views

Querying by taxonomy vs Querying by Custom fields Speed Comparison

I'm developing a listing portfolio for our project. (Basicaly yachts with their type, size, price, cabins, draft, build year, refit year etc.) I should filter them according to type and sort by ...
0
votes
1answer
48 views

Multiple terms not working on taxonomy

I need multiple terms support my WordPress theme - $boards = get_user_meta($user_ID, '_Following Board ID'); $pboards = get_user_meta($user_ID, '_Board Parent ID'); $paged = (get_query_var('paged')) ...
0
votes
1answer
503 views

using multiple terms in tax_query

I'm trying to build a real estate search site. first of all, here is the search form (sorry for german classes and stuff tho): <form method="post" action="<?php ...
1
vote
1answer
726 views

pre_get_posts: using tax_query only for certain post type

I have default post type posts (post type: post) and custom post type posts (post type: cpt). The latter has a taxonomy (cpt_tag). I would like to display on my front page all the default post type ...
0
votes
1answer
2k views

WP_query - Filter by tax_query and meta_query using multiple select

I have a Publications Post Type, a Writers Taxonomy and a Publications Custom 'Meta Box' Value; parent_id. In my archive-publictions-post.php template I am trying to filter the WP_Query Class, with ...
3
votes
1answer
627 views

Escaping WP_Query tax_query when term has special character(s)

Here's my issue. I have a custom post type that I'm attaching a custom taxonomy to. This taxonomy will allow the admin to provide search suggestions that will ensure the post is found when a user ...
0
votes
1answer
289 views

List posts of terms but exclude one term

I have a Custom Post Type for "Products" with a Custom Taxonomy of "Product Line." I've set up a page to list out the Products by their Product Line. However, we're also using a Product Line of ...
3
votes
2answers
386 views

template_include for search.php makes Wordpress think its on the home page

I have a custom tag-search feature, which allows people to search multiple tags to return relevant posts. Say they want to see posts that are tagged both 'Wordpress' and 'Tutorials'. I'm using the ...
1
vote
0answers
304 views

tax_query OR with empty result returns all posts

I'm running a WP_Query with a tax_query with two tax_query statements with an OR relationship. $tax_query_terms = array( array('taxonomy' => 'post_tag', ...
0
votes
1answer
264 views

Function using get_posts() with tax_query not working when called from functions.php

I want to get an array of all the 'bands' in taxonomy 'types', and use the array later on in other functions etc. I have a utilities.php file that I require() in functions.php and it has the following ...
0
votes
1answer
47 views

Running a custom query inside another cpt single and trying to grab a variable

I made a cpt "Neighborhoods" for different neighborhoods. On the Neighborhoods archive, you click on one and go to the single. All good. an example url is /blog/neighborhoods/south-austin/ But I'm ...
0
votes
1answer
126 views

pre_get_posts main_query not displaying after applying tax_query filters

Maybe someone can help me identify a problem I am experiencing with the pre_get_posts action. I have used the same code in another project before and it worked fine. I even went through line by line ...
0
votes
1answer
247 views

tax_query showing no results

I'm creating a music database site with two custom post types: tracks and albums. I've linked the tracks to their respective albums with a custom taxonomy for the album's slug. On each album page, I'm ...