Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
715 views

why is my postmeta table is so heavy

One of my database is realy heavy (+100Mo) for a site with not so many content (like 40 pages & 10 posts)). I found in phpmyadmin that my table "postmeta" is 95Mo. So i wonder to know what are the ...
1
vote
2answers
588 views

Mysql SELECT posts

how i can get posts via MYSQL from posts where language is 'en' and 'ru' I have this query $sql = "SELECT p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1 ON ( wm1.post_id = p1....
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 (...
1
vote
1answer
573 views

PHP script can't connect to Database on port 3307

I can connect to mysql just fine with my port number through the command line like so: mysql -h ##.##.##.## -P 3307 -u wpuser -p I have a php file that tries to connect to the DB, <?php ...
0
votes
0answers
17 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 ...
0
votes
1answer
41 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
594 views

Hacked Wordpress website /Homepage redirect

I am very sorry about the length of the post, please bear with me as I am going to try and list everything I've done so far. I am dealing with a hacked WordPress site which had been left without ...
1
vote
1answer
21 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
18 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 ...
1
vote
2answers
567 views

Wordpress Backend HA (Automatic failover)

Out setup is multiple Front Ends (replicated) and 2 Backend MYSQL servers (Master-Master replication). We're looking to achieve HA automatic failover for wordpress. We've got the front ends covered ...
0
votes
1answer
547 views

Insert double entry in DB

I created plugin and my plugin create new Table in DB. My problem is when user type something in field firstname, lastname... and click on button Submit, that go to my table and that is ok.. but then ...
0
votes
1answer
2k 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
651 views

UPDATE on SELECT results. A SQL query to swap Author with Meta Box value

I inherited a project where, for some reason, the previous developer make a custom post type for authors and a custom select listing all those authors cpt titles in the post edit screen. This led to a ...
1
vote
2answers
919 views

$wpdb select all meta for each post

I'm running the following query trying to get the data and associated meta data of a huge number of posts: SELECT wp_posts.post_title, wp_posts.post_date, wp_posts.ID, wp_postmeta.post_id, ...
0
votes
1answer
17 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
1answer
588 views

Plugin MySQL SELECT custom data and filter on user meta

I'm porting a custom PHP feature to be part of a Wordpress plugin. At present, my USERS table has a field (let's call it FLAG) which my MySQL query needs to filter on, eg: SELECT custom-data FROM ...
1
vote
1answer
532 views

MySql Query very slow

I have a problem with a query on my website. When I load the page it is incredibly slow and only after over 12 seconds the content starts showing. I have installed a debug plugin and found the query ...
0
votes
1answer
31 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
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
82 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
2answers
1k views

$wpdb->get_var not returning count

I'm trying to do a count for pagination and its returning NULL why the query returns results correctly. In this case $total returns NULL which is not correct why? (I didn't include the $args as they ...
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 ...
2
votes
3answers
10k views

“#1067 - Invalid default value for 'post_date'” when trying to reset AI after backup

I've restored my Wordpress database from an sql backup. However, in doing so, all of the tables have lost auto increment. When I try to add it back in with this sql ALTER TABLE `mercury_posts` ...
0
votes
0answers
14 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
0
votes
0answers
34 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 ...
1
vote
1answer
906 views

mySQL statment count of post in each category and sub category

im trying to get a count of all post for each Categorty and sub category it should show main_cat 10 -a1 5 -a2 5 i have tried this but my counts are all of and im getting ...
0
votes
2answers
5k views

Replace existing pages with new pages, keep menu links

I basically want a plugin or method that would give the same functionality as 'Enable Media Replace' but for replacing pages and posts, instead of redirecting, or manually editing. I've searched high ...
0
votes
2answers
88 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
14 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 ( $...
1
vote
0answers
609 views

Is it safe to convert tables from MyISAM to InnoDB?

I have inherited a WP site (with WP5.1 and WooCommerce 2.6.14, LearnDash 2.5.4 and few other smaller plugins). From screenshot you can see that it is a mix and match of MyISAM and InnoDB tables. ...
0
votes
0answers
17 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 ...
1
vote
2answers
792 views

Get user categories with most posts in it

I am trying to make a query to take first 3 categories with most posts per user, but no luck so far. This is where I am now: SELECT DISTINCT(terms.term_id) as term_ID, terms.name, terms.slug, posts....
1
vote
1answer
312 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
679 views

WP Database generate content for post_name column

I ran a query that deleted all content in post_name (used for SEO-friendly URLs) column. UPDATE wp_posts SET post_name = '' I thought that WordPress would automatically populate new ones if I update ...
0
votes
1answer
821 views

Add value to array in database

I have a custom database in my WordPress site where I want to save multiple values to one row. Let's say I have an entry: id: auto increment pageid: id of current page time: text (is an array ...
3
votes
5answers
21k views

Convert WordPress posts to products in WooCommerce

Is there anyway I could convert all the posts e have right now on our WordPress install into products using some MySQL query or something like that?
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
614 views

SQL Query Search page

I am trying to create a Wordpress webpage that has an input text box and a button. what I want to do is take the input text from the text box and use it as a parameter to search a table I put into the ...
0
votes
1answer
53 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
1answer
559 views

Migration of wordpress database from mariadb 10.0.20 to 5.5.50

I have been struggling with this one and cannot find an answer. I am not an expert with databases and had an issue that is a pain. I am attempting to migrate a wordpress database to a different ...
0
votes
1answer
620 views

how to insert missing tags into the posts through mySQL?

I am looking for a SQL query to insert a tag to multiple posts from a specific category. A pseudo query looks something like this: INSERT INTO POSTS VALUES TAG = "tagName" where Posts in_category("...
1
vote
2answers
3k views

How to get last updated row or ID in wordpress

How to get last updated row or ID in wordpress. Like : $wpdb->insert_id;
0
votes
1answer
578 views

How to change the publishing date of each posts?

I need to set the publishing date of many posts with the post date (the creation date). I know that I can do it editing the single post and changing the Published on value but this procedure is ...
0
votes
2answers
1k views

Problems migrating WordPress to localhost

I have just followed this guide on manually migrating a WordPress site to localhost. I have followed all of the steps: downloading files using FTP, exporting database, importing to localhost database,...
1
vote
1answer
798 views

Separate DB by yearly archive of Wordpress

I have large DB of blog post I already export it by year and wanted to make archive by year doing it on subdomain, like 2012.mysite.com I stack looking for solution on internet, I wondering if their ...
0
votes
1answer
2k views

How to do a MySql query in WordPress?

I want to get the last auto-incremented ID's value of a particular table. I found a MySql function on the internet to do that. But I'm not sure how can I use this function in WordPress to get the ...
0
votes
2answers
664 views

how to check for wordpress Query errors

In mysql or mysqli you can add this type of Query: <?php $sql = mysqli_query($con, Insert into database itt (name) VALUES ($name)") or die(mysqli_error($con)); ?> What does wordpress do ...
0
votes
1answer
642 views

Processing forms with php to wordpress database

I'm simply trying to process data from an html form into my wordpress database through php. I've tried multiple times to get the data inserted but have had no luck. The setup is as follows: Database ...
1
vote
1answer
13 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 ...

1
2
3 4 5
29