Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mysql]

MySQL is an open-source, relational database management system.

0
votes
1answer
53 views

Error inserting into custom table - Object of class wpdb could not be converted to string [closed]

Getting the above error when trying to insert into custom table .I am unable to find out what is the cause of the error. The error comes at line 17. Any help is greatly appreicated. The code is ...
1
vote
0answers
41 views

How to delete all customer user account that haven't placed a single order?

Recently I've had an influx of spam users registering on my Wordpress website and I am trying to delete them all if: they have a "Customer" role haven't placed at least one order before As I could ...
0
votes
1answer
36 views

Delete Users without a First and Last Name

I need to clean a WordPress Web site of SPAM users. I checked the Users list and noticed that valid users have a proper Name listed; SPAM users do not have that value and a - is displayed instead. ...
0
votes
1answer
27 views

SQL query to delete users with multiple meta keys and comments

I need help putting together an SQL that can delete users if they don't have (metakey1 or metakey2) and (does not have comments) I have this SQL which does it for single meta_key SELECT * FROM ...
0
votes
0answers
34 views

Display multiple meta_key/meta_values by single SQL query

This is my query SELECT P.ID, P.post_title, P.post_content, P.post_author, MAX(IF(PM.meta_key = 'ex_latitude', PM.meta_value, NULL)) AS lat, MAX(IF(PM.meta_key = 'ex_longitude', PM.meta_value, NULL)) ...
0
votes
0answers
21 views

Is it possible to replace MySQL with JSON files for WordPress

I'm interested in the question, Is it possible to replace MySQL database with JSON files for WordPress? Let me explain what I mean. We have 12 standard tables after WordPress installation. We can ...
0
votes
1answer
33 views

Order by custom table and multiplication

I want to order posts by multiplying values from a custom table. +---------+------+------+------+------+------+ | post_id | a | b | c | d | e | +---------+------+------+------+------+--...
0
votes
0answers
172 views

Wordpress MySQL Search and replace with wildcard?

I'm trying to search and replace for a link with wildcard in phpMyadmin. If I simulate this query UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" ...
0
votes
1answer
25 views

Getting Error Trying to Create Table

I'm trying to create a new table in phpmyadmin. I'm using MAMP and this is of course inside wordpress. <?php function testtheme_database() { global $wpdb; global $testtheme_db_version; $...
0
votes
1answer
40 views

SQL query to bulk change short code in all posts

PHP/SQL noob here. Based on this question I attempted to change some entries in phpmyadmin for my wordpress blog: I want to all galleries to link to file instead to file attachment (add link="file" to ...
0
votes
1answer
74 views

Windows Setup: Error establishing a database connection

I have MySQL 8.0.12, PHP v7.3.2 64Bit and Apache 2.4.38 64Bit installed. In theory I have everything that is needed to run WordPress locally. Through MySQL Workbench, I have tried the Host, Port, ...
0
votes
2answers
31 views

Where is the HTML-handler part in the wpdb class?

I'm trying to understand how datas are being handled when saving to the database in the wpdb class. I have searched for where HTML string datas are handled and found a method in the $this->query() ...
0
votes
0answers
14 views

How to display the last keywords used during 1 day (1 per post)

I want display the last keywords used during 1 day but 1 keyword per post. Like this: It's like the topics of the day. You can check the example in https://www.latercera.com/ <ul id="footer-tags"&...
1
vote
1answer
21 views

Bulk activate a theme on multisite

I have a multisite and a new theme that needs to be activated across all subsites. I found an answer by fuxia from 2012 and would like to know (1) if there have been changes in WordPress since that ...
0
votes
4answers
57 views

Remove a shortcode from all Wordpress posts

I changed a wordpress theme on an old site and removed all plugins which were unnecessary. All went well except for a shortcode that was used by the earlier author shows up on every post. For ...
0
votes
1answer
21 views

Exporting Post ID, Post Title, Primary Category and Primary Category ID

Trying to export the following data from WordPress or directory through MYSQL query. Post ID | Post Title | Post Content | Post Excerpt | Post Primary Category | Primary Category Term ID | Post ...
0
votes
0answers
30 views

WordPress Multisite IIS domain name bindings - error 404 and 503 - database issue?

I have two sites setup in my multisite setup, besides the main site, that are working with no problems. Each site is setup with a separate domain that I setup in the bindings in IIS. If I setup the ...
0
votes
0answers
22 views

Featured image from custom to Wordpress database

I want to adapt my old custom website database (composed of only one table) to Wordpress database. All data has been correctly imported in both tables (wp_posts and wp_postmeta) with a php code that ...
0
votes
1answer
28 views

How to show result of sql query in a page?

I have a table in the same DB that I have a WordPress page and I want to show in the land page the count of total of rows and then I need an another page that show the information of this table , How ...
0
votes
0answers
32 views

Issue with mysqli_set_charset

Every once in a while I get this error on my site. I currently have Debug mode enabled. I notice it more when I click on many links or make many updates to the website within a short time frame. Then ...
0
votes
2answers
27 views

Wordpress member notification

I try to implement a function to notify users about changes on the webpage. I tried to use sessions for that but it did not work very well. For example: A User can attend an event. To do that he has ...
2
votes
1answer
65 views

Too many datadabse connections - upper ceiling mysql

We run a high traffic blog with around 500 real-time users and 10000 posts. We are hosted by self on VPS - 16gb, 4 core with separate mysql DB server - 4gb, 2 core; both SSD. No problem with hosting ...
0
votes
1answer
44 views

Need help with format of nested array in MySQL

I build a plugin, that is able to run through a CSV file and parse the variables into custom fields of a custom post. In my custom post type, I build a meta box with repeatable custom fields. The ...
0
votes
0answers
14 views

Integration between Datatables Server Side Processing and Wordpress

I have a created a table using Datatables and a simple SELECT query from my Mysql database. I realized that for big amount of data, it's better use server side-processing to speed-up the records ...
0
votes
0answers
9 views

Creating search page based database information

I am new to WordPress but not to web development. I have a mySQL database of information of products, and I want a user to be able to enter in a search bar for a product and all products containing ...
0
votes
0answers
18 views

SQL Query to delete featured images in particular post type within a specific date range?

I saw this answer... Query to delete all featured images and remove post meta? ...but it deleted ALL featured images and post meta. I would like to do the same for all "events" posts created by ...
0
votes
1answer
82 views

DELETE WooCommerce Order data from database

I spent some time in my DB trying to figure out how I can clean out some completed order data. Below is the query that I am confident will help remove the data from completed woocommerce orders. My ...
0
votes
1answer
17 views

Sorting query_posts() with a complex orderby filter

I'm trying to order my posts with a complex orderby scenario which uses the CASE and WHEN syntax. To achieve that, I've created a filter : add_filter( 'posts_orderby', 'order_properties_by_reference',...
1
vote
1answer
19 views

Change the category of all posts in it

I'm trying to make a category change of some posts by MySQL. But I am not able to give the update in the database, it is giving error when running the query. UPDATE * FROM mooca_posts LEFT JOIN ...
0
votes
0answers
10 views

getting the list of main product pictures

I want to remove the background from the main picture (the picture that shows up in catalog) of all my products. I want to get the list of these pictures. I know all the picture are in wp_posts table ...
0
votes
0answers
51 views

WordPress asks to install, but is already installed?

I know this has been resolved many times including here, but I can't figure this out in my case. I've been using XAMPP for Mac on Mojave and recently, I updated it to the latest version of - 7.3.1. ...
0
votes
0answers
12 views

Mysql Error in querying form entries in Gravity Form plugin

This is my code. <?php global $wpdb; $entry_table = GFFormsModel::get_entry_table_name(); $sql = $wpdb->prepare( "SELECT * FROM {$entry_table} WHERE id=%d", $...
2
votes
1answer
102 views

Sortable admin column for one meta key with three possible meta values

I've looked over 2 or 3 similar looking threads regarding sortable columns and the meta queries involved with making them work. None seem to resolve my exact problem. I am using the pre_get_posts ...
0
votes
0answers
33 views

Blank character set with WP-CLI

On one of our servers, WP-CLI seems to be convinced that the character set must be an empty string. $ wp db cli mysql: Character set '' is not a compiled character set and is not specified in the '/...
0
votes
1answer
38 views

Custom route and query

I am trying to use a custom WordPress route and function, but I am getting a route and function not found error. Below is my code but I am not sure where it is breaking: add_action('rest_api_init', ...
0
votes
0answers
17 views

Installing MySql 8 for WordPress dev machine, what is the correct table name sensitivity option?

Context When installing MySql 8, the installer asks for if the table names are all lowercase or preserve case. Question What is the correct setting in case I would like to run WP 5 on that MySql ...
0
votes
1answer
291 views

How do I merge WooCommerce categories with the same name?

I have duplicate product categories - they share the same name but different slugs eg., The category 'Adhesives' has a slug of "adhesives" but since updating my products via CSV import, there is now ...
1
vote
1answer
176 views

Order by summing multiple values

In a custom post type (products) I want to order products by summing multiple values based on user selection. I use custom taxonomies to filter the products. I could use the orderby meta_value but ...
0
votes
1answer
33 views

WordPress Database Query works in phpMyAdmin but not in the code

I have a simple SQL query: SELECT * FROM test_table__csv_import_temp_joblist WHERE url ='https://www.example.com' In phpMyAdmin, it works well and returns a result. In WP it returns nothing: $sql ...
0
votes
0answers
22 views

HA WordPress implementation question

I am looking forward to eliminate SPOF in my PHP/Nginx/MariaDB/Redis WordPress website. For this purpose, I am about to move from a single server to a more complex HA scenario that as far as I ...
0
votes
0answers
24 views

Issue developing an AJAX form with Wordpress

I am trying to develop a custom form working with AJAX. But there is no way to work because everytime it gives me the below message: "POST http://wellness4yourself-com.stackstaging.com/wp-admin/...
0
votes
1answer
31 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
0
votes
0answers
13 views

Issue Converting Get_Results to Prepare to add a variable

Afternoon all. I'm trying to convert the following get_results query to allow the use of a variable dependent on which page link will be clicked for a team roster page. I currently have 3 different ...
0
votes
2answers
26 views

WP + MySql db / PHP

I have a website running WP connected to a MySql db, where the latter uses PHP. I did not make the site and have only small experience with WP. This may be a simple question. The WP also uses ...
0
votes
1answer
23 views

Why can't i come back to older working version of php after ugrade with error log on php 7.2 and 7.3

I'm getting locked out of */wp-admin/ there is an error log. Its after changing php 7.2 to php 7.3. The error doesn't disappear even if i go back to php 5.6 where MySQL_connect function exists and is ...
-2
votes
1answer
43 views

why you don't Implement PDO for access every thing to database

that is.. why wordpress don´t use PDO if it is more secure, and prevent a lot of injections, and issues with security. Thakns
1
vote
0answers
42 views

how to solve slow WordPress site caused by attachment_metadata

My WordPress sites starting to become slower by time, after two years they become very slow. I tried many things, such as: improved my DB, used cache plugins (WP Rocket and W3 Total Cache) which both ...
0
votes
1answer
277 views

How to insert data into MySQL database from the form created in WordPress site

How can I insert the data entered into the form in WordPress site to the MySQL database? I have created a form in the site. I am able to run PHP codes using snippets but I don't know how to update the ...
0
votes
1answer
86 views

Ajax $wpdb not returning table data

I'm using WordPress 5.0.2 with WooCommerce 3.5.3 and I have two selects dropdown field on the checkoutpage. I want to retrieve the selected region_code value from the billing_region dropdown and then ...
0
votes
1answer
37 views

Update MySQL query so that it functions again

I've inherited an old WordPress site that my customer doesn't want to be rebuilt. It has an old MySQL query in the functions.php of the theme that is supposed to put a category image with the ...