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

learn more… | top users | synonyms

1
vote
0answers
44 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 * ...
0
votes
1answer
126 views

Inserting Post Meta From SQL

I'm trying to get post meta to be updated/replaced with $wpdb and running into issues. I have working SQL, but cannot get it work when coding it up for my WP plugin. Extra note: The post meta being ...
1
vote
1answer
12 views

My SQL function to change user_name

My wordPress database was hacked and all users_names were changed to the same thing. I'd like to write a mySql query to replace all usernames that = "x" to the user_nicename. I'm unsure how to do this ...
0
votes
1answer
42 views

How to properly send many mysql queries via php and what happens with ajax requests after they are sent?

I need to update the details of a few thousand accounts and I can't do it with pure MySQL, I need php too. With all the loops that's probably around 100k mysql queries. I chose to do it via a button ...
1
vote
0answers
20 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 ...
0
votes
2answers
40 views

Re-writing MySQl query for execute faster

Can any one re-write this SQL query to perform better? At present this query takes about 29 seconds to execute in BlueHost server while it takes 6 seconds in HostGator.com server. My intention is ...
1
vote
2answers
29 views

What happens if I overwrite the current wp_options table with a backup from a week ago?

I have a rather silly situation. I tried this query UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins'; which disabled all my plugins. I was testing some issues on ...
0
votes
1answer
32 views

Geographical proximity query using post_meta

I realise this might be an inefficient query, but I'm trying to grab latitude and longitude values from the post_meta table that are connected to posts to figure out the proximity of the posts to a ...
0
votes
1answer
28 views

Custom post order when using OR relation

I have a custom post type named Faculty. They can be any of the type MCT, MLT, or MT. MCT -> A, B MLT -> C, E MT -> C, D I want to list all MLT and MT faculty on a page in order by last ...
0
votes
0answers
17 views

Ordering topics by most replies in X days using MYSQL statement

I'm using the following MySQL statement to grab the topics (BBpress custom post type) that have the most replies (custom post type like comments) in the last X days. However I've found that I get ...
0
votes
1answer
20 views

Copy from wordpress for dev gives different output in browser

I'm trying to accomplish the following: Havin a copy of the current live site to do some development. I would currently prefer to have the dev site on the same server. I did the following: List ...
0
votes
1answer
238 views

Migration problems with mysql: Operation not allowed when innodb_forced_recovery > 0 [closed]

I'm transferring a bunch of domains a new host. The site names remain the same, and for the sites I've already migrated, no manipulation was necessary in the database. It just works once name-servers ...
0
votes
0answers
22 views

Search Replace long text string no action in phpmyadmin and not in Notepad++

After an update of my Avada Theme there is a new section widget that I like to use. To use it I need to replace a very long text string with a shorter text string. But somehow phpmyadmin and notepad++ ...
0
votes
1answer
946 views

MySQL: How to change url in posts from xxx.com to yyy.org?

Recently I switched my domain, unfortunately before that a lot of posts had internal linking to my own other posts by including the old yyy.com domain. I need to change it in all my posts, via MySQL ...
0
votes
1answer
41 views

What should a WordPress developer know about MySQL? [closed]

During my 1 year job, I usually get to work with the front end and rarely get a chance to run any query. I have written 0 queries so far. What knowledge of MySQL should a WordPress developer have?
0
votes
1answer
64 views

wp_usermeta - Read from database, but save function broken

I added a custom field to the profile-page of WordPress users called "uidnumber" and it reads values from the database just fine, however it just doesn't save anything. I'd rather save it in ...
0
votes
2answers
37 views

How do I change the user via SQL?

I change a user via SQL in wordpress: SET @old_user='old_user'; SET @new_user='new_user'; UPDATE wp_users SET user_login = replace(user_login, @old_user, @new_user); UPDATE wp_users SET ...
2
votes
2answers
96 views

Proper way to work with wpdb to get user's firstname

I want to use $wpdb to get user's firstname. I know how to do it with php and mysql query, but I want to use $wpdb. The problem is that I don't know how to use it. I tried to create simple query to ...
0
votes
0answers
46 views

SQL Query to export Buddypress Profile data

I need to use sql query to export for http://wpdatatables.com, the code the plugin generates comes with error and I've tried phpmyadmin and sql pro with same error SELECT wp_bp_xprofile_data.value, ...
1
vote
1answer
30 views

Unable to set a default serialized array using dbdelta()

I am trying to set up a table with dbDelta() and one of the columns will have as default a serialized array with predefined values. The issue here is that dbDelta() explodes the query using ...
0
votes
0answers
28 views

Render a Wordpress menu from outside Wordpress?

I would like to render a menu in another system outside wordpress using SQL to fetch the menu contents and some logic to build the actual menu. I turned on mysql logging to see what wordpress was ...
0
votes
1answer
66 views

Edit Account - read and write to MySQL

I have user data that's being saved to and read from the database as they are all standard WordPress fields. example: $user->user_email And here's the code I have inside the ...
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 ...
0
votes
0answers
37 views

Posts page in WordPress dashboard very slow

I have a WordPress install that has about 4800+ posts. Most of the posts does heavy usages of categories and tags. My site itself is very responsive, but on dashboard, specifically Posts > All ...
0
votes
0answers
45 views

How to add form to insert the data to custom table using mysql?

here's my form: Full Name: email: Product no: ...
0
votes
0answers
16 views

SQL query to load a menu and contents [duplicate]

I would like to render a menu in another system outside wordpress using SQL to fetch the menu contents. I'm able to find a menu item based on the slug: SELECT * FROM `wp_terms` wt WHERE wt.slug = ...
0
votes
0answers
47 views

Unique ID based on SQL Table

how can i create or generate a unique id that will based on a table like users.id then insert that result to an different table column field? this is how i call the table that need to insert results ...
0
votes
1answer
31 views

writing inner join in wpdb

I have a problem in writing SQL Inner Join syntax in wordpress, This logic should definitely work, I tried this in phpmyadmin and it works fine SELECT booking_calendars.cal_name FROM ...
0
votes
1answer
38 views

Is there a page length limit?

I am developing a site and it has 4k lines of content for some of the page (this is when you view source). It is in WordPress, however, I can't seem to add anymore content. It doesn't even respond ...
0
votes
1answer
20 views

Get multisite count without php?

I'm writing a program in Python that outputs information about Wordpress installations and I'm adding some features to detect Multisite installations and their details. I would like it to print how ...
0
votes
0answers
52 views

Fill table in WordPress with MySQL data

I'm unsure on how to do this as I've never coded a MySQL database directly into a website, so I appreciate any help I can get. What I want to accomplish: I have a MySQL table in my website's ...
1
vote
2answers
91 views

Query All users that has post

I have this query so far : $user_args = array( 'role' => 'frontend_vendor', 'orderby' => 'display_name', 'order' => 'ASC', ...
0
votes
0answers
77 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 ...
0
votes
0answers
66 views

What is the cron doing?

So I installed the P3 plugin to analyze the plugin load time at my site. It was OK at the actually analyzing but just a really poor plugin that basically crashed my server which has great specs over ...
0
votes
1answer
63 views

How to get product order by two custom taxonomy in wordpress

Yesterday i stuck in the middle of code that how could i retrieve product belong to specific custom taxonomy ordered by other taxonomy. Table wp_posts: id | post_title ---------------------- ...
0
votes
0answers
67 views

Best practice for writing backend forms to interact with database

I am responsible for a Wordpress site where ingredients, recipes, allergens and similar data is inserted into the database. All the columns in the database are separate from the Wordpress database, ...
0
votes
1answer
93 views

Remove empty rows from the database

I'm writing a script to alter the post content column in the database and I just notice it has a lot of empty rows, these seem to be deleted posts that now have no content or anything, I don't like ...
0
votes
1answer
95 views

How to create a post based on data in a table?

I have a MySQL table which I created that contains fields for a Title and a Body. There about 100 records in this table. I would like to create a Wordpress post for each row in this table. Is that ...
0
votes
1answer
75 views

Removing the first image in content

I've been using this code: function remove_first_image ($content) { if (!is_page() && !is_feed() && !is_feed()) { $content = preg_replace("/<img[^>]+\>/i", "", $content, 1); ...
0
votes
0answers
286 views

How to export table from database in CSV file format (making custom plugin)

I am making a plugin. It stores emails in table of a database via html form and displays the emails in administrator page. I also want to include a button, that enables the export of emails in CSV ...
1
vote
0answers
175 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 ...
0
votes
1answer
142 views

What might be the reason of Couldn't fetch mysqli_result on another domain?

I'm developing a plugin and it works fine on my Wordpress website, but I've tested it on other domains with different Wordpress instances. When trying to activate the plugin on some other sites and ...
2
votes
1answer
33 views

What are conventions about the schema of the $table_prefix

I wonder if there are any conventions or best practices about the table prefix of any WordPress set up. The official documentation on wordpress.org does not make any statements to that topic. ...
0
votes
1answer
50 views

Changing order of db results when encoding to JSON

There is probably a very simple solution to this but I just can't work it out. I am getting some info from the wp database, bypassing WP's built in classes, then echoing the results as encoded JSON ...
0
votes
1answer
56 views

WP_Query always returning the last custom post

I have code that works fine on our live system, and I'm porting it to a new theme. In the new theme, the WP_Query always seems to return the last custom post. My function is: function ...
0
votes
3answers
95 views

Same option_id=0 for 2 options in wp_options?

What does it mean when (according to mySQL Workbench) 2 options have option_id = 0? Just noticed this for unrelated plugin and theme holding very different options. Update Just noticed over 200 ...
0
votes
1answer
55 views

Wordpress mysql table double prefixes

Currently working on updating a wordpress website for a client of mine. The wordpress mysql database has double prefixes in it though. The standard wp_ prefix and her own custom prefix for the ...
0
votes
1answer
61 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 ...
0
votes
0answers
50 views

Setting up automated post status change / delete system

Haha, first of all, I've been asking all my WP questions in stackoverflow and then wondered why everybody said they don't know nothing about WP. My question is simple: What's the best way in your ...
0
votes
1answer
43 views

Conditional statement within WP SQL query

I have a form on a Wordpress page posting data to a table called 'members'. I have a second page displaying this data in a table. All is working well. The data is being displayed using: $myrows = ...