0
votes
0answers
15 views

Wordpress MySQL query to add multiple users with related article

What I need is to add 100 users to wordpress and each one should have one post assigned to him, like a profile page (I don't want to use the default wordpress profiles because in the feature each user ...
0
votes
0answers
32 views

Get a list of the last posts grouped by author and filtered by category

i need a list of the latest post published by various authors, but filtered by category, like for example the latest posts of author that write about music. i wrote this query and looks like working ...
0
votes
1answer
28 views

WP_Query hit max joins… How else can I build a search function that uses custom fields?

I'm trying to search a custom post type of "Properties", while doing so I'm also searching the custom fields using multiple (anywhere from 5-30) meta_queries. The problem is Wordpress or MySQL is ...
1
vote
2answers
81 views

Add “Category” to Mysql Query

i need your help :) I've made this custom Mysql query on WordPress: $querystr = " SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id IN( SELECT DISTINCT ...
1
vote
2answers
88 views

Single meta_query query using OR instead of AND in request's WHERE statement

I want the native WordPress search input to search metadata in addition to its standard title and content search, however setting a meta_query adds an AND clause to the request when what I need is an ...
1
vote
1answer
282 views

How to count post meta key values for all posts in database

In my post meta data I have the following 'key' for every post: "image_details" a typical value of which is an array such as: ...
0
votes
1answer
819 views

meta_query on a date range using an array of values

How can I do a query to return the post if the custom field array contains a date that is within the specified range? The query below is basically what I am after but it does not work... // the ...
0
votes
1answer
17 views

meta_query dates from an array

I have the below query which isn't returning anything. The query is meant to look for the date (2014-03-01) that is in the array, which it is. Any ideas? Or would I need to use a custom SQL query? ...
0
votes
2answers
724 views

Query multiple meta key values for template

I am using this template: http://demo.undsgn.com/studiofolio/front-page/ I tried to make some modifications because I need the homepage template to display an excerpt beneath each thumbnail. I copied ...
0
votes
1answer
5k views

Order by DESC, ASC in custom WP_Query

I need to do multi-level ordering in a query. The issue is with ordering one value DESC and the other ASC as in SQL. The following SQL seems to give me what I want when I run it in terminal: SELECT ...
0
votes
1answer
171 views

Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also ...
1
vote
1answer
235 views

Mysql query and order meta value

I made a mysql query to WordPress like this: $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND ...
3
votes
2answers
651 views

How to prevent execution of default query, while preserving ability to use WP_Query in template?

PROBLEM: I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries: ...
3
votes
2answers
115 views

Query meta field using between

I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that. Let says I have these in the database Meta-key: lat Meta-value: 54.3415000 ...
0
votes
1answer
33 views

Assign a tag to custom post type using a query

I have a custom post type courses with a custom field level. I want to run a query (mysql or WP query) that runs through every course (post) and if the level is greater than 3, append a tag called ...
1
vote
1answer
614 views

Help with WP_Query - Too many mySQL queries

I need some kind of help with wp_query. Am I doing something wrong? I am getting a lot of mySQL queries, while building a new theme. My WP_Query is: <?php $args = array( 'post_type' => ...
4
votes
1answer
334 views

find a random blogid across my multisite network that has at least one post published

I need to find a random blog across my multisite network that has at least one post published of a certain post_type, and return its blogid as a variable so I can use it in a switch_to_blog() call. I ...
1
vote
0answers
180 views

Query most popular terms by taxonomy over 2 week period

I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks ...
1
vote
0answers
229 views

List authors with the last post title and order by last post date

I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them. // Selects from tables wp_users and wp_posts, selecting published ...
0
votes
1answer
103 views

Different sql queries count indicator on the main page [closed]

I use w3_total_cache plugin. But i can`t understand what is going on sometimes. I have enabled database caching and debug info at the bottom. Sometimes on the main page 90-96 db queries, sometimes ...
0
votes
2answers
261 views

Parsing External Table Arguments

I have a client project that has posts assigned to their country of origin. The client wants to be able to search the posts by continent and or region. I have a separate table that assigns each ...
0
votes
1answer
184 views

get_var is neither a string, integer, or array …?

$vote_count = $wpdb->get_var($wpdb->prepare("SELECT votes FROM wp_mytable WHERE product = %s AND company = %s", $product, $company)); ...
1
vote
2answers
493 views

Mysql query LIKE not working

I'm using this code. $blog_list = $wpdb->get_results( "SELECT " . $extra . "blog_id, last_updated FROM " . $wpdb->blogs. " WHERE public = '1' AND archived = '0' AND mature = '0' AND spam = '0' ...
0
votes
1answer
819 views

Difference between 'LIKE' and 'IN' in meta queries

You can use a variety of different comparison operators in meta queries, among which are 'LIKE', 'NOT LIKE', 'IN', and 'NOT IN'. What is the difference in use between LIKE and IN? Here's the ...
4
votes
2answers
2k views

Get posts by menu ID

I'm a little stuck here. I have a menu in Wordpress with some posts in it. What I would like is to retrieve all the posts as objects. I think I'm pretty close, but the SQL query doesn't seem to work ...
0
votes
3answers
796 views

How to find if a post with custom_field == X exists?

I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?
0
votes
2answers
976 views

Custom query_posts() parameter

I'm adding voting features to a theme. Visitors can vote posts Up or Down. I created a table for storing number of votes for each post and that works fine. Now I'm trying to sort posts by their votes. ...
1
vote
1answer
406 views

if statement on database query

Part of a voting script I'm working on: I'm checking a custom table in my WP database to see if a user already voted for a post by checking the IP address and the post id. If the user's IP already ...