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

Display category posts grouped by taxonomy

I’ve found a solution! <?php // Get current Category $get_current_cat = get_term_by(‘name’, single_cat_title(”,false), ‘category’); $current_cat = $get_current_cat->term_id; // List posts by the terms for a custom taxonomy of any post type $post_type=”myposttype”; $tax = ‘mytaxonomy’; $tax_terms = get_terms( $tax, ‘orderby=name&order=ASC’); if ($tax_terms) { foreach ($tax_terms as $tax_term) { $args = array( ‘post_type’ => $post_type, “$tax” … 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

Remove the Homepage Query

The posts_request filter Skimming through the WP_Query we find this part of interest: if ( !$q[‘suppress_filters’] ) { /** * Filter the completed SQL query before sending. * * @since 2.0.0 * * @param array $request The complete SQL query. * @param WP_Query &$this The WP_Query instance (passed by reference). */ $this->request = apply_filters_ref_array( ‘posts_request’, … Read more

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