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

learn more… | top users | synonyms

2
votes
0answers
5k 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 ...
2
votes
0answers
276 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 ...
1
vote
0answers
50 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 ...
1
vote
0answers
32 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
90 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
83 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
108 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
257 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
403 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
120 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
201 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 ...
1
vote
0answers
104 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
266 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
174 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
474 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
132 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
297 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
446 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
831 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
404 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
415 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 ...
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
136 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
358 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
231 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
320 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
75 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
6 views

'username_exists' still returns an ID even after deleting record from the database?

Is there some kind of MySQL query cache turned on by default or something? I am trying to work on a user import script and I am seeing some strange results from the username_existsfunction after I ...
0
votes
0answers
11 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
24 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
21 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
15 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
21 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
35 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 ); ...
0
votes
0answers
24 views

Join Wordpress databases from 2 different installs

I'm just now getting into SQL and the core of Wordpress (PHP). So I'm not an experienced WP developer but not intimidated by the tools. But, if the answers could be dummied down a bit would be very ...
0
votes
0answers
31 views

WP_Query order by number of likes

I'm trying to configure WP_Query to order by number of likes. I have a custom table called 'likes', which records which liker (user ID) likes which post: id | liker | post_id 1 | 11 | 120 2 ...
0
votes
0answers
42 views

How to delete a stuck post using phpMyAdmin

I was attempting to change some leftover http:// references in the DB using Update/Set SQL statements. I was getting confident and started doing them in bulk and stopped noting exactly what I was ...
0
votes
0answers
17 views

WordPress Stored Procedure - Commands out of sync, you can't run this command now

I'm having trouble trying to call a stored procedure for my WordPress plugin. I am receiving the following error: CALL category_GetName(3) Commands out of sync; you can't run this command now ...
0
votes
0answers
50 views

How to create a coupon in the database?

I added over 1000 coupons (schedule ones) in the database. I had one line in wp_posts and several wp_postmeta tables per coupon. To add, I've saw how a coupon was represented there and I've made ...
0
votes
0answers
29 views

How to configure MySQL-SSL-Access to a MySQL Server 5.5 when a list of CIPHERS seems mandatory?

I have a MySQL 5.5 Server with SSL setup. I can connect with my MySQL user via command line from the webserver to the database server over TCP and verified the connection is encrypted. I figured out ...
0
votes
0answers
45 views

SQL Query for all posts in specific category

I try to add a custom field to all posts in specific category with a sql query. This query set meta_value of new meta_key as post_author value in ldn_posts table. Here is begin of the code (works for ...
0
votes
0answers
35 views

How to unwrap/separate Html tags in pages?

I have around 300 pages with some of them having wrong HTML formatting that I have to fix. I want to: Separate the H1 tag from the inner tags. Moving the TITLE (found in span) to H1. Get rid of the ...
0
votes
0answers
17 views

Database table not created without error

I have this code to run on activation to create the table $table_name = $wpdb->prefix . "codes" function code_install() { $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " ( id ...
0
votes
0answers
41 views

Send data from plugin to external database

I'm creating a plugin that I need write data to an external database (not the wp db that the plugin is on). I know I can use require_once with a separate config file with the external db details in ...