What triggers these wordpress queries on my homepage?

Are the queries themselves displayed or are the results displayed? If the results of those queries are being output onto your homepage it’s a potential security vulnerability. The query returns user data including username and password hash for user ID 1 of the wp_users table, which is the administrator user that WordPress creates when first … Read more

Order by meta values

You can do this by just looking for release_date_db: function plugin_name_get_posts() { global $wpdb; $the_posts = $wpdb->get_results( “SELECT * FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND meta_key = ‘release_date_db’ AND meta_value >= 20120000 AND meta_value <= 20121231 ORDER BY meta_value ASC;”, ARRAY_A ); }

Pagination in custom query not working [duplicate]

I believe the query var that you are retrieving should be paged and not page. See the codex and adjust your query to the following: $products_query = new WP_Query(array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ‘paged’ => (get_query_var(‘paged’) ? get_query_var(‘paged’) : 1), )); However, if this is an archive for your product post type why … Read more

WP_Query search by multiple meta key and distance

You can do that. There are filters available in WP_Query that enable you to modify the query just as you like. The filter posts_clauses filters all of the parts of the query together. There are also filters specific to the parts of the query too. The best way to know about them is, search posts_clauses … Read more

WP_Query breaks pagination

If you want to stay with a new Wp Query, as in your example, changing your $allsearch name for the query variable to $wp_query should do the trick. Looks like the pagination functions are expecting that variable name for the query… So, try that…

Query posts by custom fields

I managed to figure it out (finally) after about 12 hours of screwing around. The answer here gave me 98% of the answer, and the rest was simply using the appropriate hooks to modify it for my use and to include the postmeta table.

wp query problem

While comparing numbers in meta value use “meta_value_num” instead of “meta_value” ‘meta_value_num’ – Order by numeric meta value (available with Version 2.8). Also note that a ‘meta_key=keyname’ must also be present in the query. This value allows for numerical sorting as noted above in ‘meta_value’. Reference

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