All Questions
119
questions
0
votes
0
answers
26
views
WP_Query does not return the result even if the data is present in the database
I have a plugin that has following code
$posts = new WP_Query([
'post_type' => 'campaign',
'meta_query' => [
'relation' => 'AND',
...
0
votes
0
answers
81
views
WP query taxonomy optimization
Is there any way to speed this query? Noob here.
SELECT wp_posts.ID
FROM wp_posts
LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE 1=1
AND (...
1
vote
0
answers
156
views
Using hook to use DISTINCT in a wp_query
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts
INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )
INNER JOIN wp_product dg ON dg.post_id = wp_posts.ID
AND ( dg.location IN ('XV', ...
1
vote
1
answer
39
views
Looking for most performant way to execute several similar WP queries within shortcodes
I have a very data-driven website where each page contains several (5-10) shortcodes, each of which execute WP queries and display the results.
The queries are usually quite similar - I've added 3 ...
1
vote
1
answer
475
views
Why is variable not working on custom sql query using wpdb?
Im trying to insert bulk post meta in a single query, however when it wont insert data if i use variable on it.
Here are my codes so far.
I added comments on which codes work & which does not.
(...
0
votes
1
answer
300
views
Passing in MySQL prepare statement parameter separately throwing error
I have some code that looks like this:
$stmt = $wpdb->prepare("SELECT * FROM <tablename> WHERE user_id = %d", $user_ID);
It seems to work fine...
However, I have some queries that ...
0
votes
1
answer
804
views
Which is faster wpdb & get_row or wp_query & ge_post_meta?
Im planning to make a private api and i was wondering which one should i use go for my datas.
wpdb & get_row with my custom sql
regular wp_query & get_post_meta()
Im wondering if it's better ...
0
votes
1
answer
34
views
how to get Nearby zipcode
I need to get close/Nearby to zipcode list data zipcode so I'm using the example table name li_zipcode:
id
zip_code
latitude
longitude
1
35004
33.557327
-86.534508
2
35005
33.604744
-87.042442
3
...
0
votes
1
answer
296
views
What database state changes happen after a post is manually "updated" with no changes?
After importing a series of posts (using WP All Import), my (custom) page template is unable to access the post's contents/fields. However, if I open the post in the editor and click "Update"...
1
vote
1
answer
489
views
What's wrong with this WP query?
With kind help of Sally CJ who answered my question, I was able to create a WP Query, but it still gives me unexpected results. When I write the query in raw MySQL, it works fine, but with the query ...
1
vote
1
answer
901
views
How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
While searching with the argument s it adds additional value before and after each Like query
SELECT wp_7_posts.ID FROM wp_7_posts WHERE 1=1 AND (((wp_7_posts.post_title LIKE '{...
0
votes
1
answer
574
views
How I can change the condition or compare operator for WP_Query in pre_get_posts
So here is my problem
I want to show Posts if have same category if not have post then show post of same tag. And to do that I am using "pre_get_posts" action. and setting query like ...
-1
votes
2
answers
558
views
How to Delete Posts by title?
I have about 2000 titles. How can I automatically delete posts with these titles?
For example
1
vote
1
answer
74
views
Improve wp query perfomance on large db
I have 100000 records in my database and so many meta query performed on it so it takes lot of time to perform the operation, what is the way to speed up this?
It takes 20 to 25s to load this query.
...
1
vote
0
answers
678
views
pagination with 'no_found_rows' => true,
I have 100000 records in my database and so many meta query performed on it so it takes lot of time to perform the operation, have checked few articles and using them it suggest disable no_rows_found ...