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

learn more… | top users | synonyms

3
votes
0answers
6k views

How to use update and delete query in wordpress

First i write manually update, delete, insert and select query and execute data with mysql_query function Like this: Select query $prefix = $wpdb->prefix; $postSql = "SELECT DISTINCT post_id ...
3
votes
0answers
277 views

How to let a user choose an authors and save it to the database?

I have a multi-author Wordpress site which reads different rss feeds and posts them to my page. I was wondering if it is possible to make a code that would provide an opportunity to registered user ...
2
votes
0answers
447 views

Wordpress Deadlock Error

I see more of this error these days in error_log. I see that someone asked this question here a year ago but no solution. Please advise what is causing this issue. Already, tried deactivating some ...
1
vote
0answers
62 views

Visual/Text Editor displays blank pages in WP-Admin- but HTML on client side displays correctly

Theme: Hemingway, Twenty-Sixteen Host: Bluehost Browser(s): Safari, Chrome OS: OSX El Capitan 10.10.5 (14F1605) Website When I try to "Edit Page" visual editor screen is blank, in both Text and ...
1
vote
0answers
31 views

How to translate this mySQL query to $wpdb query

I'm having trouble recreating a query from straight mySQL to $wpdb compatible. SELECT meta_value FROM `wp_postmeta` WHERE meta_key = 'review_rating' AND meta_value = 5 AND post_id IN (118,117,116,...
1
vote
0answers
34 views

MySql query to get posts with all meta and terms

I'm trying to figureout a way to get all fields from wp_post with all of their custom fields and categories in one mysql query. So in one row of the result I should have post fields with their custom ...
1
vote
0answers
27 views

Trouble Migrating all data blog from Wordpress.com to Wordpress.org

I'm transferring a WordPress.com blog to a new WordPress.org website but I'm having trouble transferring everything. I've gone through the usual WordPress tools - export XML file, import using the ...
1
vote
0answers
97 views

inserting a post from an extern php file but post content doesn't show on wp site

I'm doing a php file that insert post's on my wordpress site. I'm filling all the fields in wp_posts, but the content doesn't shows on my wordpress site. I wonder if it's because the categories are ...
1
vote
0answers
88 views

Proper usage of $wpdb->update()?

I am trying to update my custom table in Wordpress using the following php code but still no success: $tablename = "wpfeedback"; $data = array( 'mark' => $mark, 'comment' => $...
1
vote
0answers
127 views

Manually query posts by taxonomy with MySQL

I'm trying to query posts from the WP database with the category uncategorised, while also joining the post meta table, but I can't get it to work. I get an empty result. This is my query SELECT * ...
1
vote
0answers
23 views

Regarding “Insert query error” in wordpress

I am getting "Insert query error" in my WordPress eCommerce website when I click on the place order button. My error is: Insert query error - Table 'i1503672_wp6.wp_wa_product_orders' doesn't ...
1
vote
0answers
27 views

How to add a private user page populated from sql?

I have taken over management of a Boy Scout website for around 75 kids. The site is a vanilla WordPress site and has no access control (other than admin). I would like a scout/parent to be able to ...
1
vote
0answers
279 views

Slow SQL_CALC_FOUND_ROWS Query

We are experiencing very slow performance with queries that use SQL_CALC_FOUND_ROWS within the admin section of WordPress. We currently have about 125,000 posts on our site and use Varnish to cache ...
1
vote
0answers
129 views

mysql_real_escape_string() vs. esc_sql() in WordPress

Does mysql_real_escape_string() and esc_sql() in WordPress both do the same thing? I tried the following: $fetch_row='<p>And again for single posts</p>' echo mysql_real_escape_string( $...
1
vote
0answers
207 views

Set Display Name to first and last name (phpmyadmin SQL Query)

I'm trying to change all the users Display Names to be their first and last name. I have looked into a number of plugins and wrote my own PHP to try and accomplish this however the site has over 50,...
1
vote
0answers
419 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', '...
1
vote
0answers
106 views

MySQL query to mass change role of users

I'm looking for a MySQL query to achieve this purpose: Change the role of users that never posted and have registered before at least 60 days. The role to be changed to is a new role to be created ...
1
vote
0answers
279 views

wpdb custom tables without plugin

I am using custom tables, with $wpdb, trying to perform basic queries at the moment. I can't find anything on manually creating tables then using them with $wpdb, everything is plugin related. I ...
1
vote
0answers
177 views

Slow wp-admin due to “SELECT DISTINCT post_mime_type FROM wp_posts WHERE post_type = 'attachment'”

The media library on a large site is slow in wp-admin. I did some research by looking into slow queries in the sql and found that this query is causing the slow response: SELECT DISTINCT ...
1
vote
0answers
30 views

How to migrate the posts from an old custom legacy blog to a new WordPress website?

I have to migrate the posts of a very old custom legacy blog made in ASP (the posts are stored in a MySql table) into a new WordPress blog. So I need your help to find the smartest solution to do it, ...
1
vote
0answers
493 views

Slow meta_query with about 4 milion record on wp_postmeta

Although optimized wordpress all the way but still very slow as follows : I have converted from LONGTEXT meta_value field to TEXT Then create INDEX for this field ALTER TABLE wp_postmeta ADD INDEX ...
1
vote
0answers
133 views

Calculate average crossing post categories

In my WP database I have some posts i the category hotels and some other posts in the category visits. In the posts (placed in the category visits) there is two meta_fields ( rating and placeid ) ...
1
vote
0answers
302 views

Renaming admin user on multisite install by MySQL

As part of a general tightening of security, I want to change the name of the admin user on my multisite install to something less commonly used. This user is admin on all five sites in the network ...
1
vote
0answers
454 views

How to track a users progress through pages by inserting data into Wordpress Database?

My website users can learn British Sign Language through Video Tuts, Quizzes and games etc. I would like to track the users progress through the pages of the course and add that data to a Wordpress ...
1
vote
0answers
849 views

$wpdb->insert() does not Insert record in a table

I'm trying to understand and get hold of the $wpdb global object but can't seem to make it work. Basically, I'm trying to insert a single record into a custom table in wordpress DB. Instead of ...
1
vote
0answers
409 views

Wordpress running SQL query to update database from form

Basically I want to take information in from a form and use a separate php page to update the database. so here is the original wordpress php page (add_person.php): <?php /* Template Name: ...
1
vote
0answers
419 views

Cleaning up bloated wp_postmeta table by removing multiple _thumbnail_id's?

On a very old site (7 yrs) with a lot of posts (30k) I've been trying to whittle down the database tables. The postmeta table is 1.5m rows, 750k of those rows are for a meta_key named '_thumbnail_id'....
1
vote
0answers
3k views

How to fix database error duplicate entry

At first I thought this was just a damaged table, so I tried repairing via MySQL, but it appears there's more fundamental issues. Which of the duplicates should I remove, and any further advice in ...
1
vote
0answers
137 views

WordPress plugin overloading with tmp tables

I have asked at the plugin's (WordPress Popular Posts) support a few days ago, since no response hope to get some insight or help here. Thanks. Hesitant to tweak settings like max_heap_table_size &...
1
vote
0answers
360 views

WordPress Query wp-terms SLOW

I've got a very large database in WordPress with lots of products in WooCommerce along with quite a bit of taxonomies. When querying the products on the front end it takes 1 minute or more. Here is ...
1
vote
0answers
91 views

Regex to turn embedded images in to attachments

I've got a blog that has all images embedded in each post rather than a thumbnail linking to an attachment page which is what I'd like. I understand from this question that no plugin (like Regenerate ...
1
vote
0answers
233 views

Query most popular terms by taxonomy over 2 week period

I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks --...
1
vote
0answers
323 views

List authors with the last post title and order by last post date

I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them. // Selects from tables wp_users and wp_posts, selecting published ...
1
vote
0answers
76 views

How can I make wordpress suppress mysql errors?

Wordpress has two functions related to SQL queries and their errors as mentioned in What Is The Difference Between suppress_errors() And hide_errors() in $wpdb? From what I've read setting WP_DEBUG ...
0
votes
0answers
12 views

Social Wall plugin GETs are filling up httpd logs

Six months ago I set up a WordPress installation for an intranet. It worked fine until a few weeks ago, when the MySQL server started crashing. Perhaps is unrelated, but by looking at the httpd ...
0
votes
0answers
20 views

Pass the data from Custom Form in wordpress

How can I get the value from custom form in WordPress and stored into teh database? Here is my form. I used the bootstrap validator for this form. Now, what do I have to do to get data from this form? ...
0
votes
0answers
11 views

Database with mixed collation (utf8mb4 & utf8_general_ci)

Each time I was uploading my WP install from offline to online, I was noticing strange characters in text and digging a bit I have discovered that wp-config.php on the online server was set to define('...
0
votes
0answers
15 views

Override $table_prefix only for the options table

The only documentation i found was too obsolete. (https://wordpress.org/support/topic/two-sites-two-themes-one-database-same-content) and this one (Change options table prefix only) doesn't help me. ...
0
votes
0answers
37 views

How to generate notifications when MySQL data base changes

I am developing a WordPress multisite and I am wondering how I can generate notifications when MySQL database changes? For example the user in site #1 can sell his society. When he selected it, it ...
0
votes
0answers
19 views

wpdb->prepare clarification

Is there anything wrong with using wpdb->prepare() to retrieve items from a custom database table? Note how I've used prepare() below, without passing the $type variable through prepare(). I just ...
0
votes
0answers
30 views

How to change the capabilities from upper case to lower case, while inserting onto database?

I am trying to insert custom user roles like Student, Teacher and Parent. While inserting the capabilities into the database, it is displaying the role in uppercase. I am not able to fetch the user ...
0
votes
0answers
16 views

Sharing tables between 2 different websites based on the same database

I have 2 different websites installed on the same database. The 2 websites are sharing the users tables, but I want them to share the posts tables too. I tried to do it by editing wp-db.php. After ...
0
votes
0answers
15 views

Trim data before insert?

Recently I use this syntax to input data like below: $STRING_DATA = StrToLower(Trim($input_data)); $wpdb->query ( $wpdb->prepare ( 'SQL SYNTAX WITH PARAMETER STRING', $STRING_DATA ) ); Do I ...
0
votes
0answers
34 views

Advanced search query select from custom table

Hope that anyone can help me with this problem. I have 7 columns in my tbl2014wines custom Wordpress table. I am trying to create an advanced search feature that allows users to search by wine_name, ...
0
votes
0answers
26 views

INNODB Supports transactions, row-level locking, and foreign keys

When I try to create a table for a plugin (that was dropped in the past) I get the error: #1005 - Can't create table 'database_db.wordpress_popularpostssummary' (errno: -1) (Details…) And the ...
0
votes
0answers
39 views

Cast woocommerce events date meta_value with wrong format in WP_Query

I'm using woocommerce events plugin to sale tickets in a client site. The client wants to display the next 3 events after today in the home page. I have created this code: $args = array( '...
0
votes
0answers
27 views

upgraded a MySQL 5.1 database to 5.5 and now my wordpress site wont connect

I was upgrading my package with my ISP and they told me to export mySQL database create a new one and import the data via PhpMyAdmin. They neglected to mention that the new database would be ...
0
votes
0answers
26 views

Database collation and char set issue

I attempted to import my WordPress website from local host to live server online and i get an error #1115: that i have wrong db collation of utf8mb4. So i googled and changed the cllation to ...
0
votes
0answers
22 views

After Submitting Form Successfully, The Values Not Stored In Wordpress Database

<?php /** * * Template Name: xoneform * */ echo "Welcome to Xone Form"; ?> <?php print_r($_POST); if ( isset( $_POST['submit'] ) ){ $insert = $wpdb->insert( 'wp_xone_form', ...
0
votes
0answers
37 views

Query can not search data with space?

I have following code $wpdb->get_results( 'SELECT * FROM '.$device_token_table.' WHERE user_pushtoken="'.$server_method['user_pushtoken'].'" AND user_id = '.$user_id,ARRAY_A ); print_r($wpdb->...