Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
178 views

How to bulk delete a certain part of all wordpress posts

site been hacked, and all posts been injected a line of js code under the content! <script src='https://js.xxxxxxx.ga/stat.js?n=ns1' type='text/javascript'></script> I have found the ...
1
vote
1answer
19 views

How to remove Database Table in Wordpress via Function file?

I recently installed Rankmath, I am using different Page Builder, Where the content not readable by the Plugin. So I disabled SEO Analysis from Setting. Now I wonder if we can remove this Table from ...
0
votes
0answers
5 views

WooCommerce get specific orders by Customer ID SQL

Trying to get specific orders by the customer ID via a raw SQL query. I'd like to input which order IDs I'd like to retrieve, but only retrieve them if they match a specific customer ID, here's what I ...
0
votes
1answer
23 views

Display a number value from mysql query in WP

Anyone have a suggestion on how I can display the result of a SQL query in a WP post or page? The query statement is a SUM statement and I want to only display the resulting number value on the page. ...
1
vote
0answers
14 views

C# user_nicename and Display name blank

I'm writing a C# application to add subscribers to wordpress. The problem I'm having is the user_nicename and display_name fields in the database are showing but in the WordPress Users interface the ...
0
votes
0answers
10 views

Building a WP Dashboard for client information, NOT changing the admin dashboard for the site

Does anyone have suggestions for how to build a dashboard to show outside information such as sql queries? I know it sounds simple and like I could Google it but every search only turns up how to ...
1
vote
2answers
27 views

mysqli_error() expects parameter 1 to be mysqli, null given in own db class

I created a plugin and defined a shortcode there. This includes my own PHP scripts (pages). The data are in a second database. The direct mysql query works fine (testcode), but the db.class create a ...
0
votes
1answer
20 views

How to do database for download stats?

So I have a existing wordpress site and we are building now download section for it. Downloads will be custom post type and files. Now we need to have some stats, like number of downloads per cpt (...
0
votes
0answers
16 views

How to install Wordpress from hosting service with mysql database from Compute Engine GCP?

I own a wordpress website (website.com) that running well with hosting service (cpanel). So i want to create a new subdomain (new.website.com) and install wordpress in there but for the database i ...
0
votes
0answers
11 views

Unable to save or update posts with Emoji

I host my WordPress (v5.4.2) blog on 000webhost.com and I am unable to save any post with emoji characters. I get this error Updating failed. Could not update post in the database I have tried ...
-1
votes
0answers
20 views

How to make sure WordPress database doesn't have any problems?

I'm transferring a WordPress site to a new server. On the new server, getting things ready, I was using the "Optimize Database after Deleting Revisions" plugin to maintain the database ...
0
votes
1answer
28 views

Can I split a huge wp_postmeta table across different databases or servers?

This question doesn't have any codes, it's more of a theoretical question. I need guidance on what method to look for. I've searched on google before but found nothing on this specific case. I have 2 ...
1
vote
1answer
11 views

Show MySQL errors that occur when I excute $wpdb->insert()

I have the same problem as Nathan ($wpdb->last_error doesn't show the query on error), obviously, the solution to the specific case was to change the type of data to the column that caused the ...
0
votes
1answer
15 views

Run Username SQL Query from WordPress Child Theme Functions File

Having an admin account, I can change everything except the username (which happens to be the login name). I am therefore wondering how to change the username using the functions file. Running the ...
0
votes
1answer
16 views

How can I add a new row in a separate database when someone registers via Wordpress?

Apologies if this is question is too general or in the wrong location but I am new to SQL, Wordpress and web hosting. So I am a game developer using Unity C# to create a multiplayer game. I am using ...
0
votes
0answers
15 views

how to get data from two different table from wordpress database

I have two different table in wordpress one is custom table and another is wp_usermeta table. one email is matched from both table so i want to get data from both table using email address is matched. ...
0
votes
1answer
30 views

I can't separate the array by commas

I have a problem I cannot separate the array by commas if I put the implode it only shows the first number and not the second in database i need insert in database 500,756 global $wpdb; $arg=array(...
0
votes
0answers
21 views

When I add metadata, metavalue length is added in to the value in some cases

When I use the following code: update_post_meta($new_post_id, '_test_metakey1', 'a:1:1;'); update_post_meta($new_post_id, '_test_metakey2', 'a:1;'); The database adds the keys as follows: Why does ...
0
votes
0answers
25 views

MySQL query to select Advanced custom fields (ACF) in WordPress from the database

MySQL query to select Advanced custom fields (ACF) in WordPress from the database. I have a simple WordPress website with custom fields i want to select(query) all the custom fields data from ...
0
votes
0answers
12 views

Changing stock value from txt file using PHP

I have a txt file that stores info (sku, name, stock) from products. Is it possible to read from this file and insert only the stock value to wp database using php? Thanks
1
vote
1answer
13 views

When Wordpress Default table, Echo Success. When Plugin Table, Echo Blank

When I used this code, the result/echo display as I wanted. <?php $user_checks = $wpdb->get_results( " SELECT ID, user_nicename FROM $wpdb->users " ); foreach ( $...
0
votes
0answers
15 views

504 Gateway Time-out after custom plugin inserts data into mysql database

I have a custom plugin that inserts multiple rows into a custom table in the wordpress database. After about 50 seconds I get a 504 Gateway Time-out error. The 50 seconds is around about the time it ...
0
votes
1answer
48 views

WordPress fails to install with “Can't Select Database” Error (WAMPServer)

UPDATE: 2020-07-12 I tried installing on Windows 10 64-bit and it failed to install WordPress with the same database error as on Windows 7. That tells me that either there is a bug in WAMPServer 3.2.0 ...
0
votes
0answers
13 views

Can I use the main Multisite as a backend only?

I need to implement an admin solution to manage a multitude of existing sites that each lives on an individual subdirectory on the same domain, with their own respective databases, users, themes, etc. ...
0
votes
1answer
47 views

Insert, update or remove data from database (usermeta)

I have a situation here. I'm writing a custom plugin for WordPress. I'm dealing with an issue: I'v created a metabox for Custom Post Type with add_meta_box and with a callback function where I ...
0
votes
2answers
2k views

Fresh install OK, upgrading PHP 5.4 -> 7.3 fails with “Use of undefined constant WP_CONTENT_DIR”

On my HostGator shared hosting with a CPanel option to set PHP per domain, if I turn on PHP 7.3 (or other 7.x versions) for my existing blog I get an error page: Warning: Use of undefined constant ...
0
votes
2answers
59 views

Huge wp_options table

I have a problem on a WP site. Website crashes because there is no more available disk space. Searching, i detect that wp_options table size is 12GB, but only have 1100 rows aprox: Any ideas? Thanks ...
1
vote
1answer
10 views

Redirecting to old domain after migration website

Could someone help me with restoring my website (with new domain name)? I have a database backup and when restore it, wordpress is redirecting me to old website and domain. I changed site url in mysql ...
0
votes
1answer
11 views

edit_user_created_user hook - using to update Groups

I am integrating Gravity Forms, Gravity Forms User Registration Add On and Groups by ithinx. I have written the following function: add_action( 'edit_user_created_user', 'hl_add_group', 10, 1 ); ...
0
votes
1answer
14 views

Get posts from category with custom query

I've got a custom sql query to get latest posts from specific category (ID = 62). It looks like this: SELECT p.ID, u.display_name AS author, post_date_gmt, post_title, p....
0
votes
0answers
9 views

Hosted wordpress site on a digital ocean droplet often making error establishing database connection

I have a wordpress site which is hosted on digital ocean droplet which is throwing error error establishing a database connection From the front end. This happens very often once I restarted the ...
0
votes
0answers
41 views

local wordpress broke after changing URL

So basically I am trying to figure out LAMP. I installed wordpress locally on the machine, let's say, with 192.168.0.72 ip address. The site folder is in var/www/html/wordpress/. Everything worked ...
0
votes
0answers
21 views

How can I turn rows into columns in mysql?

I ran the following query to display user data (I don't know much about databases but I can see the data I need). SELECT wu.ID, wu.display_name, wu.user_email AS E_mail, wc....
0
votes
0answers
18 views

Unable to ORDER BY numbers

I am using WPTables to display data in a mySQL database, it all works fine and without issues, the problem is it sorts oldest first, I need to sort by newest first, here is an example: http://...
0
votes
0answers
23 views

WooCommerce product page too slow (too many DB queries)

I am using WooCommerce for online store and I've found that product page extremely slow down because of related products that are loaded with main product. The product page without any related product ...
0
votes
0answers
10 views

Too many rows on wordpress wp_options table

On one of my sites I saw that in wp_options table there are more than a hundred thousand rows after a while they all start similar to something like: _wp_session_ _wp_session_expires_ and it mosty sas ...
0
votes
1answer
24 views

“BS_” rows in postmeta table

I am pruning my WordPress site's MySQL database and noticed that there are thousands of rows in the postmeta table with the prefix "BS_". BS_author_type BS_guest_author_name BS_guest_author_url ...
0
votes
1answer
20 views

Passing Current User ID into SQL statement

I have the following code: $userID = get_current_user_id(); echo $userID; $sql =" SELECT wp_users.`user_email`, wp_wp_pro_quiz_statistic.`correct_count`, ...
0
votes
1answer
26 views

Issue with fetching mysql data and displaying results via shortcode in webpage

I am learning to develop a custom plugin which currently has the purpose of reading data from the wp database and displaying the data. I believe my initial SQL statement is correct in that it fetches ...
0
votes
1answer
17 views

How to optimize and reduce excessive database queries

After we have run our codes and is functioning the way we want, something else faces us in the future and thats speed and scalability. Example a blog site must query the database to pull blog contents ...
0
votes
3answers
68 views

How to convert objects into arrays

Please i need assistance in converting objects that is returned from $wpdb->get_results into arrays so that i can call them values like $query['username'] instead of using $Query->username because ...
0
votes
1answer
28 views

Delete oldest wordpress post (SQL query)

I've reached the database limit on my hosting platform. I want to add a function to my functions.php that deletes the oldest post in my database anytime that I publish a new post. function ...
0
votes
0answers
10 views

How to optimize query which remove duplicates for 2 million items

Good evening, This is my query which should remove duplicates from table. How can I optimize this for two milion records? DELETE p1 FROM wp_ads_platform_users p1 INNER JOIN wp_ads_platform_users p2 ...
0
votes
0answers
17 views

MYSQL: only seem to be able add one category instead of array

I want to add posts to category called "New York" (ID 88) and also to category "USA" (ID 89) based on regex, I cannot seem to get it to add to both at once. Managed to get it working just for one. ...
0
votes
2answers
41 views

How to insert multiple rows and columns in database using array

Please i want to know if it is posible to use one sql query to insert into multiple columns and rows using array in php $sql = "INSERT INTO MyGuests (firstname, lastname, email) <br> VALUES (...
0
votes
0answers
12 views

How vincule a image with a product via mysql

I want to introduce a product and its image via mysql using php script.I am not using wordpress functions. The problem is that I don't know how to make the product have the thumbnail that I ...
0
votes
1answer
11 views

How to search usermeta table

What is the best way to search usermeta to find a user_id based on a meta_value? For example in usermeta table there is a row with user_id = 123 , meta_key = deviceid and meta_value = 45545. I know ...
0
votes
1answer
22 views

how to access 2nd Mysqli Database from different server for wordpress

hello I have an old website https://www.manthanpublication.com/manthantest hosted using Codeigniter as it is hard to customize I decide to change to Wordpress now the problem is I have student result ...
1
vote
1answer
54 views

WordPress site uses MyISAM, should I switch to InnoDB necessary?

I've been managing a site for a long time, so the database still uses MyISAM for database engine. So, now that I transferred the site to a new server using mysql 8.0.19 (before it was 5.7), I'm ...
0
votes
0answers
6 views

Excluded category from SQL query but not excluding posts from that category

I am creating a custom search for my site and written following query. I am getting problem with the query. I have excluded some category IDs like 144, 303, 333. It is excluding these categories but ...

1
2 3 4 5
29