Questions tagged [sql]
SQL (Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS).
805
questions
0
votes
0
answers
8
views
Remove posts that start with similar words (like a delete duplicate posts plugin)
Can anyone advise on a SQL query or plugin (or any other solution, as I haven't been able to find any) that can delete all posts that start with the same words, except the oldest of them? Or maybe to ...
0
votes
1
answer
37
views
Old Website SQL DB & files - is there a way to import to a new site?
I built a financial website / marketplace by using wordpress approximately 9 years ago. We had a custom domain for the site and hosted the wordpress on that domain. Our host literally folded at the ...
0
votes
2
answers
37
views
Is it possible to extract all product columns except for one?
I currently extract all product data in CSV format.
There is also the option to select columns too.
However, I sometimes want to exclude just one particular column, or maybe even a few others.
...
1
vote
1
answer
59
views
Deleting WordPress posts and media files based on author via MYSQL database
I would like to delete some of the posts in WordPress between a period based on the author via MYSQL database. I have difficulty identifying the WordPress tables and their relationships to perform the ...
0
votes
1
answer
34
views
How to get a list of all posts and their categories?
Basically I just need to have a table like this:
Post title
Categories
Post 1
Category 1, Category 2
Post 2
Category 2, Category 2.1
...
...
From MySQL Query to Retrieve Category from wp_posts I ...
0
votes
0
answers
19
views
Help writing out comments and replies
I'm working on creating a comment system for an event plugin I am creating. I have the commenting and replies forms working correctly, I just need help with writing them out to the site. I am on MySql ...
1
vote
0
answers
36
views
How to properly prepare a column name if passed to a stored procedure?
I've figured out that I can use %i with $wpd->prepare() to escape identifiers like column names. The thing is that the query I'm preparing is a call to a stored procedure like this. I want the end ...
0
votes
1
answer
268
views
How can I (partially) restore a Wordpress website from a SQL file?
Before installing a plugin, I forgot to do a proper backup of my website and now all I have is a SQL file, which is supposed to have all the contents of my website, with the following heading:
-- ...
0
votes
0
answers
47
views
How to short circuit a wordpress query that is not related to posts?
How to short circuit the below query via hooks such that the query is not run based on a condition? I tried using pre_get_posts filter but that is for posts queries only. The query runs as a part of ...
0
votes
0
answers
74
views
How to speed up WP_Posts_List_Table __construct() Query on a wordpress website with over 1 million posts?
On a website with over 1 million posts, the following from class WP_Posts_List_Table __construct() is taking a long time:
SELECT COUNT( 1 )
FROM wp_posts
WHERE post_type = 'shop_order'
AND post_status ...
0
votes
0
answers
20
views
SQL query based on two different custom field values
I have custom post type "store" that has two different custom fields: Coutry and City. When in the single country page I list all the stores in that country.
What I would like to do is to ...
-2
votes
1
answer
189
views
How does wordpress link columns from different tables without using FOREIGN KEY or JOIN?
I can't figure how Wordpress tables has been linked by not using FOREIGN KEY?
I tried to understand from this information.
For a custom plugin I want to recreate the terms, taxonomy and relationship ...
0
votes
1
answer
285
views
Where is WooCommerce order shipping methods stored
I need to create statistic about shipping methods used. I know that there a method get_shipping_methods() but it takes a very long time to use it with tens of thousands of orders. I would like to ...
0
votes
1
answer
62
views
How to address an invalid "NOT IN ()" query?
Symptoms:
In WordPress admin menu we cannot see any pages or products listed any more,
even thoguh the pages and products are still accessible through weblinks for example.
Tracing the issue:
On one ...
0
votes
0
answers
61
views
How to correctly cleaning wordpress options table
I want to clean my WordPress site options table using SQL.
I'd installed the plugin Performance Lab v2.7.0 by WordPress Performance Team which said that my autoloaded options are making my site slow (...