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

learn more… | top users | synonyms

0
votes
1answer
22 views

pagination on data fetched using SQL query

I am new with php and word press. I have a question that I am using a sql query in my posts to get data from my data base. Now the problem is that I have huge data on my post and I do not have idea ...
1
vote
1answer
24 views

Performance when getting post meta for post retrieved by meta value

I have a meta key which I would like to use to get all post meta data for a post where that one meta key matches a specific value, in one go. Example: Post 1 has a meta_key called unique_number. I ...
1
vote
3answers
47 views

How to fetch Data in WordPress using MySQLi or $wpdb

I have custom table like this: useraw 1. id (Primary*) 2. user_ip 3. post_id 4. time I am inserting data in the table using $wpdb->insert($table_name , array('user_ip' => $user_ip, '...
1
vote
1answer
21 views

Display data on Word Press site posts and pages from mysql table

I am new with word press and I have a table in phpmyadmin which has the data which i want to display in my word press site on different posts and pages. I have searched a lot around and came up with a ...
1
vote
3answers
78 views

Add user data to table when user is created?

I am trying to figure out how to add user information and specific meta data to a separate table through PHP. I would prefer to do this when a user posted to the wp_users and wp_usermeta table. I am ...
1
vote
1answer
19 views

Move value of one custom field to another

I've one custom field named as "video" and I want to copy the custom field value to my another custom field named as "theme2035_embed." I could do it manually, but since I have more than 2500 posts ...
0
votes
3answers
57 views

How to properly insert data into custom table via plugin

I have a plugin that reads data from an uploaded file and runs queries on the wp database. These inserts are into a table created by my plugin, so they aren't the post type. This is how I got it ...
1
vote
1answer
29 views

Can't get wp_insert_post to work

I'm trying to code a loop that will post articles from a SQL database. However, whenever I try to load the page I get a 500 error and nothing is showing up in the error logs. Code: <?php define('...
-2
votes
0answers
19 views

Hoping someone could explain some queries for me

The following queries are considerably slow on my site and I'm hoping someone could explain them to the best of their ability (what they're doing/requesting). SELECT SQL_CALC_FOUND_ROWS wp_posts.ID ...
0
votes
1answer
15 views

I'm trying to create a custom version of the wp_list_authors function that includes custom post types

I'm trying to create a custom version of the wp_list_authors function that includes custom post types. I have 3 authors on the site I'm working on (www.healthyeatingadventure.org). Two of them only ...
0
votes
0answers
7 views

WP-CLI's wp db create doesn't have privileges to DB_USER

Before I ran wp db create I manually created a new mysql user called kenyutso. I granted this user global privileges to create databases or else there would be an error when I do wp db create because ...
0
votes
1answer
27 views

Comment Approve - Add custom function when comment is approved

I would like to save some PHP memory when quering category page (like 5000 products at once) with average review rating, so I would like to save average rating of reviews every time I will manually ...
0
votes
3answers
50 views

Stumped on migration

I'm migrating a site from my server to a client's Bluehost (ugh) account. I've tried using All In One WP Migrate BackupBuddy manual migration (copying files & exporting a db using WP Migrate DB) ...
1
vote
1answer
35 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 ...
0
votes
2answers
38 views

Export only pages and posts with mysql dump

How to export only pages and posts using mysql database to database approach? More precisely: what tables should one select for dump (I suppose wp-posts and wp-post-meta ) is it safe to export only ...
0
votes
1answer
30 views

How can I Use 2 databases with one WordPress install

What I'd like to do is have the regular WordPress application run from its regular database, and then have a separate database for a game server which will hold all game data. What I need is to make ...
0
votes
0answers
24 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
1answer
31 views

How to make MySQL search queries with quotes

Hi everybody I run a wordpress based website and I'd like to store the search queries called by users to use them as analytics data to know what's most searched etc... So I have a custom table where ...
0
votes
0answers
27 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
19 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
38 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
21 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
32 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 ...
1
vote
1answer
76 views

How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table

I am trying to implement WP_List_Table for my plugin. I have gone through this tutorial and using its sample plugin. I have installed this plugin and just changed table name and done slightly ...
0
votes
0answers
27 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 ...
1
vote
1answer
51 views

How to bulk edit canonical url's in SQL?

I've been assigned to edit the canonical URL's (rel="canonical" found in the head)of about 600 posts on a client's site. Not all of the posts will use the same canonical url. Nor are these 301's or ...
0
votes
1answer
51 views

How to connect and insert data in database of wordpress?

On my website, there is a section called "My Ideal plank." It is a form where the user will enter their data and there will be a return message with the type of ideal board for the person. First ...
0
votes
0answers
22 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
45 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, ...
4
votes
2answers
41 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
vote
1answer
34 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
44 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
69 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
18 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
25 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
24 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
3answers
40 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
68 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 ...
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 ...
0
votes
1answer
16 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 result....
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
20 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
141 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
40 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 ...
0
votes
0answers
31 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
36 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
19 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
29 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
35 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
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 ...