How can I query all users who registered today?

Few months ago, I updated the Codex for get_users() and WP_User_Query, regarding the date_query support on the user’s registration date, in WordPress 4.1+. Then I also added a simple example on how to find users that registered during the last 12 hours. But the current question is how to find users that registered today. We … Read more

Get all image from single page using this query

Use get_children I used this code to extract all the images from a page gallery in the chosen order. you can include this code in the loop or use it stand alone. just choose the appropriate post_parent code (see bellow the code example). This example show all images associated to the page id 1, have … Read more

Is there a way of increasing the speed of this query?

We can do quite a lot to improve performance of your code. Lets set some benchmarks first BENCH MARKS I’m testing this with a category taxonomy term which has 9 posts and the post_tag taxonomy with 61 matching tags. With your current code, I get the following results 69 queries in =/- 0.4s That is … Read more

Differences between wpdb->get_results() and wpdb->query()

The difference, if you want to call it that, is that the query() is the most generalized method to do queries with $wpdb, the get_results() method on the other hand is a specific method, which does make use of the query() method to retrieve the specific results of this method and then does some work … Read more

How to get comments by post ID?

You can use get_comments. Function Reference/get comments $args = array(‘cat’ => ‘home’,’post_type’ => ‘post’)); $post_obj = new WP_Query($args); while($post_obj->have_posts() ) : $post_obj->the_post(); //display comments $comments = get_comments(array( ‘post_id’ => $post->ID, ‘number’ => ‘2’ )); foreach($comments as $comment) { //format comments } endwhile;

How to Optimize WP site for millions of posts

1. Set the query before WP_Query is run This seems to be the most important thing to keep in mind when trying to keep database queries to a minimum since the only opportunity to alter the query is, of course, before it is run in the SQL database. Normal Queries For a normal query, WordPress … Read more

Query multiple meta key values?

I feel like there’s an AND/OR confusion going on here. The queries in the OP will only return posts which have both key1 = ‘value1’ AND key2 = ‘value2’. Most WP plugins (that I know of, anyway) do not store multiple values in postmeta, for the same post, using the same key. If what you … Read more

How can I create a meta_query with an array as meta_field?

Feeding the query an array of possible values If the value in the database is a string and you want to feed the query several values: $args = array( ‘post_type’ => ‘news’, ‘meta_query’ => array( array( ‘key’ => ‘topics’, ‘value’ => array ( ‘sports’, ‘nonprofit’, ‘community’ ), ‘compare’ => ‘IN’ ) ) ); Searching for … Read more

How to display SQL query that ran in query?

Hi @Keith Donegan: If I understand your question correctly I think this is what you are looking for? <?php echo $GLOBALS[‘wp_query’]->request; ?> $wp_query is a global variable that contains the current query run by the loop. If you run the above code anytime while the loop is still active or even right after the loop … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduedueduedusedueduseduedusedus