ACF Relationship Field Search Filtering [closed]

First, read this post to understand my answer Search that will look in custom field, post title and post content You may want to use the acf/fields/relationship/query/ however, when adding the args: $args[‘meta_query’] = array(array( ‘key’ => ‘your_meta’, ‘value’ => $args[‘s’], ‘compare’ => ‘LIKE’, )); you will find that using that query, WordPress will search … Read more

Select All in Parent Category, Group by Child Category?

Here’s a straight up simple solution. Requires you to have the most recent version of WordPress though. (or at least 4.1) Using nested taxonomy query. Taking what you have, and just adding to it a bit. $args = array( ‘post-type’ => ‘episode’, ‘post-status’ => ‘publish’, ‘posts_per_page’ => 4, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( … Read more

WP_Query orderby custom field then post_date in one query

Multiple meta_query arguments with OR You may use the ‘relation’ => ‘OR’ argument in meta_query with two sets of field_order arguments: one with meta_value >= ‘0’ and the other one with NOT EXISTS to generate the main query. ‘meta_query’ => array( ‘relation’ => ‘OR’, field_order’ => array( ‘key’ => ‘field_order’, ‘value’ => ‘0’, ‘compare’ => … Read more

WP_Query with checkbox meta_query

Take a look at the codex for a better understanding of queries of custom fields but it should look something like this: $subjects_array = explode(“_”, $_GET[“subjects”]); $args = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘any’, ‘meta_query’ => array( array( ‘key’ => ‘field_name’, ‘value’ => $subjects_array, ‘compare’ => ‘IN’ ) ) ); $query = new WP_Query($args);

Order posts by ID in the given order

Starting in WordPress 3.5, the orderby parameter will allow the value post__in to sort by the order of the post__in parameter, just like in your example. It may not be ideal to wait or require 3.5+, but this will almost certainly be the best and easiest way to do what you’re looking to do. Here’s … Read more

How to get order of posts?

Found the answer from the WordPress docs. For what the query is ordered by, I use: global $wp_query; echo $wp_query->get(‘orderby’); For the order by which the posts are queried: global $wp_query; echo $wp_query->get(‘order’);

tech