How to uniquely identify queries?

tl;dr: build affordable unique identifiers for queries is possible, but is pretty useless. If you’re looking for unique identifiers for query objects, then you can use spl_object_hash, but IMHO is pretty useless: it is non-predictable, and also you get different id even if query vars are identical, but set on 2 different query objects. Only … Read more

Combining two wordpress queries with pagination is not working

You can try the following (untested): Setup the query arguments #1: (today) //—————– // Query part #1: //—————– $args1 = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘comment_count’, ‘ignore_sticky_posts’ => 1, ‘date_query’ => array( array( ‘after’ => date(‘Y-m-d’), ), ‘inclusive’ => true, ) ); Setup the query arguments #2: (!today) //—————– // Query part #2: //—————– … Read more

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

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’);

WP_Query – filter or directly?

You need to consider quite a couple of things here and it seems like you are after increasing performance of a query. The first and most important question you must ask yourself is: Do I need a custom query I have done an extensive post on this subject a while ago which you should check … Read more

get custom post type by tag

You’ll need to setup the post for the query by changing the following line to get rid of the infinite loop. <?php while ($query->have_posts()) : $query->the_post(); ?> If your looking for a custom post type, you’ll need to specify that in the query arguments: <?php $query = new WP_Query( array( “post-type” => “yourposttype”, “tag” => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)