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

learn more… | top users | synonyms

0
votes
0answers
89 views

I want to query for the 'post' and 'attachment' in wordpress using SQL query

How do I write a SQL query which will allow me to query for the 'post' and 'attachment' at the same time in MySQL? I am trying to get this information from the wordpress 'Posts' table. Please see my ...
0
votes
1answer
440 views

Query to change custom post type with specific category

I need to change several hundred posts with custom post types to regular post type but only from one category within that custom post type. So I have a custom post type 'films' and within that post ...
3
votes
2answers
31 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 ...
-1
votes
0answers
16 views

how to update same column in loop mysql [on hold]

I have a value as an array of one column of mysql table ,so how do I use update query to update this value using PHP loop at once?
1
vote
1answer
25 views

Help with a $wpdb MySQL Query

I'm wanting to expand on the following query to look at multiple meta_key and meta_value values that have been created with the Advanced Custom Fields (ACF) plugin. e.g. meta_key 'colours_%_colour' ...
0
votes
0answers
18 views

Assign $wpdb to a class property to access WordPress Database [closed]

In my PHP Class instead of calling global $wpdb all over the place to access the database I want to assign it to a class $_db property. If I vardump() my $this->_db it shows all the stuff that ...
0
votes
3answers
797 views

Fetch a single row from a custom table for to a given ID

When I want to get a single row from a custom table of my WordPress database by providing a username through function call, it does not work. When I mention the username in where clause of the query, ...
0
votes
1answer
1k views

Create an user on external database

I have wordpress site and a project management system from codecanyon. Here is the link I have disabled registration for users in project managment system, only login is enabled. I need to make users ...
0
votes
0answers
14 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
1answer
25 views

$wpdb->delete column values IN ARRAY()?

I am wondering if this is possible? $wpdb->delete( 'table_name', array('id' => array(1, 2, 3)), array('%d') ); So, in this situation, it should remove 3 rows at once, and call the ...
0
votes
1answer
448 views

WordPress get pagination on wpdb get_results

How do I gee the numbered pagination of custom wpdb result? below code will show one latest post from each authors in the site. I want to show 20 posts per page with a numbered pagination. $postids ...
0
votes
1answer
14 views

Add commentmeta custom field to every published comment with SQL

I am trying to add custom commentmeta "likes" with 0 as default value to every posted comment. I have this query but I dont see any error there, but still it doesnt work. Can anyone help me to solve ...
0
votes
2answers
24 views

Custom MySQL query to pull out Advanced Custom Fields?

I'm trying to modify the My Wish List plugin so that I can retrieve some custom fields (I'm using the Advanced Custom Fields plugin to create my custom fields in the admin end). The plugin uses the ...
0
votes
1answer
20 views

how to get postmeta info based on multiple categories?

I need to get one meta_value from wp_postmeta and I can do it with one category but I'm having problem when using another one. I have: SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta ...
0
votes
1answer
1k views

Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also ...
2
votes
2answers
522 views

wp_admin edit.php slow with lots of queries

I have about 4,000 posts. Currently when I click on All Posts (edit.php) it's taking about 10 seconds to load and I'm showing approximately 1000 queries! Most of them look like... SELECT t.*, tt.* ...
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( ...
-3
votes
0answers
22 views

Error establishing a database connection on amazon ec2

I'm getting an error establishing a database connection on Amazon EC2. The database is there and I have the right credentials. Here is my wp-config.php: <?php /** Enable W3 Total Cache */ ...
1
vote
2answers
97 views

How to find meta entries with their posts missing via SQL?

I'm looking to write an SQL query to do the following: Select all postmeta rows where the meta_value = a post id that does not exist. For example, postmeta meta_value may equal 235. Usually this ...
0
votes
3answers
32 views

Can't run database query

I am writing a function to query some information from a custom table in the database. It seems that I am unable to query the database on the field I need. function ch_details_from_id($id) { ...
1
vote
1answer
36 views

Is there a way to get 3+ dimensional array from a single MySql command

For example an array that has all the months, inside each month are all the users registered that month, and details on every user. I could solve it by simply searching for all users registered this ...
1
vote
1answer
31 views

Wordpress Database lost auto increment

After rolling back a Wordpress database to a backup version it seems that all the tables lost their auto_increment on the primary key columns. I read on another post this could be to do with InnoDB ...
0
votes
1answer
11 views

Query does not filter duplicate _sku numbers

I need to find ALL the post_id in table wp_postmeta that has duplicate sku numbers. I did this with following sql query but the query is not complete. Now I get the full list of all products as ...
1
vote
2answers
547 views

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
1
vote
1answer
19 views

Can I transfer a mysql database to another site?

I've been playing around with WP for about 2 years so I know my way around, but I'm kinda new to working with databases. I've been making sites not relying on a database too much. However, I have a ...
0
votes
1answer
632 views

How Do I Merge Categories With phpMyAdmin

I tried the following phpMyAdmin query to merge my category 112747 into my category 112748: UPDATE wp_term_relationships SET term_taxonomy_id = 112747 WHERE term_taxonomy_id = 112748; It did not ...
0
votes
1answer
16 views

Custom SELECT Query not returning the_title and the_permalink

I have written a code that splits the title of the posts into words and a custom SELECT Query searches each word for the posts so that I could show better related posts under the single post. I have ...
3
votes
2answers
128 views

Search & Remove Specific Shortcode From All Posts

Question Is there a way to remove a specific shortcode, say [print_me] from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in ...
0
votes
1answer
29 views

WP Meta Query - mixed AND / OR query doesn't work

I am absolutely boggled by this one. I am creating a search function for a property site - simple enough. Simple queries such as max_price, max_beds, rent_or_buy work ok. But I am trying to create a ...
13
votes
8answers
66k views

What SQL Query to do a simple find and replace

Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a ...
0
votes
1answer
16 views

Missing latest posts and options after DB migration via phpMyAdmin

The latest posts and options are not appearing after importing the database. I'm missing all the latest posts and the latest Advanced Custom Fields. The export is from the remote server and import to ...
0
votes
1answer
1k views

How do I properly update the Wordpress database password?

A site that I manage was recently compromised and I am going through the steps to harden and re-secure the site. I would like to change the MySql database password and want to make sure I do not take ...
32
votes
6answers
24k views

Why is my database import losing text widget data?

I've created a site in WordPress on our development machine. In the theme we're using there are numerous widget zones to display text in (sidebar and front page). I've used simple Text widgets in all ...
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 ...
-1
votes
1answer
26 views

SQL error #1062 - Duplicate entry '1' for key 'PRIMARY' [closed]

When I want to import database, I get the next error: Error SQL query: -- -- Dumping data for table wp_comments -- INSERT INTO wp_comments ( comment_ID , comment_post_ID , comment_author , ...
0
votes
1answer
403 views

Wordpress doesn't display accents after migration

I know this is a common question, but I've searched a lot and only experience this since a few months, without knowing what's causing this issue of course, maybe since a Wordpress update. This is now ...
1
vote
1answer
29 views

Enabling plugin failed because MySQL user do not have CREATE permissions

Has anyone else had this problem? I'm trying to enable SearchWP plugin (but i don't think this is that specific plugin problem, but maybe my settings?) but it gives me the following error: Please ...
0
votes
1answer
25 views

Remove Featured Image based on Date

I have an issue I can't seem to fold a solution for. I'm looking for a way to mass remove the featured images of posts older than X amount of days. 150 days is my target but if I can set it to ...
0
votes
0answers
16 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
2answers
95 views

sql for querying post and their category

I'm trying to query the wordpress database for the post and what category they belong in. Is there a sql query that I can use for this? Thanks,
0
votes
1answer
32 views

Wordpress Multisite with thousands of blog

I'm setting up a wordpress site where each user will need to have their own blog. My thought was it's the perfect use case of Wordpress Multisite. I've setup it with multisite using Sub-directory and ...
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
1answer
24 views

Use variable in SQL statement

I have this: <?php $jerseys = $wpdb->get_results("SELECT order_item_id, order_id FROM wp_woocommerce_order_items WHERE order_item_name = 'Mystery Jersey'"); echo "<p>Jerseys</p>"; ...
0
votes
3answers
960 views

Reset/Reorder posts ID in the MySQL wp_posts table

I have a Wordpress site that is considerably popular. I am in the process of optimizing the site before adding other plugins such as the WPML plugin which I suspect will be using custom post types. ...
0
votes
1answer
27 views

How to add query vars with paginated URLs?

How I can insert some custom url parameters to pagination links? the code below display like page.php?cpage=2 But I would like to add a parameter category with value fruit. So, the final url will ...
9
votes
5answers
12k views

What are the recommended database permissions for WordPress?

I just got WP running on my own server. I am not trying to lock things down more. What permissions should the db user have to my WP db?
24
votes
4answers
24k views

MySQL Database User: Which Privileges are needed?

The short installation instruction for WordPress ("5 Minutes") state that: Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and ...
0
votes
1answer
16 views

Weird characters displayed when importing WordPress MySQL db

I was thinking that it may be the collation, but I have no way of know what the production db collation is. The local one has been changed between UTF8_bin and UTF8_general_ci, to no avail. I'm seeing ...
0
votes
0answers
179 views

Google-App-Engine[PHP]: Error trying to establish database connection

Hi to whom this may interest, I am finding a problem with the cloudsql as database connection is not being established. I have followed the following site step-by-step ...
0
votes
0answers
164 views

$wpdb->query(update) not working as supposed when passing GET request in the where clause

I have made a table 'wp_mostfavourite' in wordpress database, it has got three fields, 'serialno', 'postid', 'counts'. The 'counts' is supposed to be increased by 1, whenever the following query is ...