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

learn more… | top users | synonyms

1
vote
1answer
498 views

Large database causes slow load

I have a 2GB WordPress database (using InnoDB Storage Engine) and I noticed my site loads slow when I press the publish button right after I selected a featured image in the media library. I had a ...
0
votes
1answer
94 views

Create a WordPress administrator without access to back-end

My site recently got hacked, and all my admin users lost their administrator level access. But when I access mySQL database, I saw all the users still exist. How can I create an administrator when I ...
0
votes
1answer
36 views

Filtering problem

I got the custom_post_type_data in which I store some variables when I make a new post. Variables likes Author, Price etc. I implemented a filtering by author, so when you click on James (for ...
1
vote
0answers
103 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 ...
0
votes
2answers
97 views

querying user bookmarks from a large number of bookmarks

I am trying to access the bookmarks created by a single user. The key is stored in the links table, attribute link_owner. However, get_bookmarks() seems to load the entire table and all I am left ...
2
votes
1answer
711 views

Inserting Hundreds of Thousands of Posts at Once

I have a project in which I create an array of 200k+ lines w/ 25 fields that run the wp_insert_post and update_post_meta. To start it processes pretty fast the slows down a lot after 10k records or ...
-3
votes
2answers
420 views

Preventing duplicate entries in mySQL database with PHP

I have a contact form (Contact Form 7) that submits all fields into a mySQL database (via the Contact Form 7 to Database Plugin), everything is working fine with that. I want it to however, throw the ...
1
vote
3answers
130 views

Replacing link URL ending strings via MySQL

We are about to purchase a site that uses Amazon affiliate links. Naturally, they have their own affiliate ID, Amazon affiliate links look like this: ...
1
vote
1answer
74 views

Delete all one-word comments

I'm trying to delete all wordpress comments with only one word. I found this mysql query to delete all comments at once, but that's not what I want to achieve: DELETE FROM wp_comments WHERE ...
0
votes
2answers
133 views

Make a database query using WordPress

I am working on a Wordpress theme that has a homepage slider. I have a table in Wordpress database that stores post view counts and I would like to make my slider show the top viewed posts. This is ...
0
votes
1answer
85 views

Help with Related Posts Function

I'm trying to write a function that will grab all related posts according to the term of a taxonomy. I'm having trouble though trying to query multiple terms. The way I am doing it right now is using ...
0
votes
1answer
2k views

WordPress mysqli and PDO

Does wordpress code base use mysqli or PDO? I know PDO is superior to mysqli but mysqli is not bad neither. Plus from one of the features of what makes PDO is superior to mysqli ( that is being ...
1
vote
1answer
263 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 ...
0
votes
1answer
216 views

How to back-up a database on IIS

I've been having trouble finding a good tutorial on how to back-up a WordPress database using IIS as the web server. I installed WordPress using IIS's web platform installer and now I can't even find ...
0
votes
1answer
221 views

Contact form with database integration issue

This is more a question about the idea I am going to share and ask for advice for. I would like to have a contact form on my site, where people complete their data and it gets stored inside a ...
0
votes
1answer
51 views

finding out the top 5 source ( source is a custom taxonomy ), in a given category

The client I'm working with have thousands of articles and media ( audio/video ) files. To WordPress, all are posted by Author ID 1, which we named as STAFF. All the content though in reality has ...
0
votes
1answer
80 views

Way to extract wordpress data from folder backup

Before my HDD crashed, I backed up the C:\wamp folder. Can I extract the wordpress posts/pages using another localhost on a different pc?
3
votes
2answers
105 views

Query meta field using between

I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that. Let says I have these in the database Meta-key: lat Meta-value: 54.3415000 ...
0
votes
2answers
180 views

Changing MySQL password via WHM - does this affect WordPress?

For security, I changed the CPanel password for an account via WHM. There's a checkbox option that says "Sync MySQL password with account password." If I go ahead and change the password, does that ...
4
votes
1answer
167 views

Custom query to get post names beginning with a digit

I'm implementing an A-Z index for a custom post type. I've got my links printing out the page and the query working for the letters. However, the numbers are tripping me up because I don't want them ...
4
votes
2answers
201 views

How to log mysql errors from wordpress core?

I am developing a wordpress site and I would like to be able to log and handle mysql errors from wordpress core. My site has a mix of wordpress pages and posts + a few php pages that run under the ...
1
vote
1answer
2k views

How to get a Google maps SQL->XML->map marker tutorial to work in WordPress

I have been trying to figure out what is wrong with my code for a couple days now, and I cant seem to crack it. I am trying to follow this tutorial: ...
1
vote
1answer
159 views

Migrating from PDO using SQLite to clean new install using MySQL

I've been using PDO plugin for wordpress and SQLite database. It does not work as expected so I want to use MySQL database, but without PDO for Wordpress since I cannot trust that plugin anymore, It ...
0
votes
1answer
217 views

How to check for empty and not a failure

I'm querying the postmeta table to see if a url has already been entered, using this statement (where $thisLink is the url I'm checking) $mypostids = $wpdb->get_results("select * from ...
0
votes
1answer
358 views

How WP decide to show or not to show in admin panel the pop-up window with hint? Need a fix

To all newcommers the WP3.5 show the floating hint about new abilities of 3.5 version placed on top left coner of screen saying: We’ve combined the admin bar and the old Dashboard header into ...
0
votes
1answer
204 views

Handling large N data in WordPress

I realize that this also pertains to PHP and MySQL in general, but the context and operation is within WordPress. Introduction I am currently developing a plugin that creates and saves data about ...
1
vote
2answers
527 views

wpdb->prepare function remove single quote for %s in SQL statment

I am using the below wpdb->prepare function in a sql statement. I am passing in several variables some field names and some values. When I try to use the %s for the field name it puts single quotes ...
5
votes
3answers
2k views

is it possible to run some php code within a wordpress page?

I'd like to access a DB table and render it in some data grid format using php on a dedicated wordpress page, accessible to members of a certain group. Is this at all possible with wordpress or is ...
1
vote
2answers
133 views

How to simultaneously access the same MySQL database in the main column and sidebar of Wordpress?

I've wrote some basic custom PHP code for my Wordpress site. The code basically access a MySQL database (a different database from the wordpress database) and displays the information. In addition to ...
0
votes
1answer
178 views

Can't create tables with my plugin

Here is the code: <?php /* Plugin Name: MyPluggin Plugin URI: http://localhost/ Description: Version: 0.0.2 Author: localhost Author URI: http://localhost/ License: GPL2 */ ...
1
vote
0answers
204 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
1answer
101 views

Using custom tables for old posts

I have a site with about 24,000 posts and 200 posts daily and the database will get huge soon. So I plan to transfer the old posts to custom tables to reduce the database load. There's no need to show ...
0
votes
1answer
156 views

Efficiently loop over huge number of posts

I want to loop all posts to do some processing, but one of my concern is there are many posts and it might used up my memory, so I want to loop posts with offset, something like paging. e.g. $posts ...
1
vote
1answer
120 views

How to adjust code to refresh a dropdown box with tags that are active on filtered category listing

I have multiple custom tags setup (ptags) and custom posttypes (products) and made it so i can filters posts by multiple tags in a category. Currently the code retrieves tags from posts relating to ...
0
votes
1answer
29 views

Assign a tag to custom post type using a query

I have a custom post type courses with a custom field level. I want to run a query (mysql or WP query) that runs through every course (post) and if the level is greater than 3, append a tag called ...
3
votes
2answers
923 views

How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?

Normally, a MySQL database can be exported and imported using these simple SSH commands: Export: mysqldump -u USERNAME -p DATABASE_NAME > filename.sql Import: mysql -u USERNAME -p ...
2
votes
2answers
365 views

How to do a MySQL dump from production site without using a search and replace script for local development?

I performed a MySQL dump of my WordPress production database to be imported into my local development environment. I plan on frequently performing this database dump and import. Is it possible for me ...
0
votes
1answer
415 views

Defining the same price to all WooCommerce Products

All of my products on my site are $1 and during an import I did using WooCommerce import it didn't save all the _regular_price & _sale_price values, so there is no way for the user to buy that ...
0
votes
2answers
181 views

How to update wp_posts with just the returned comment count from wp_comments (SQL GROUP BY)

I am doing a special migration from someone's custom CMS to a WP installation. I successfully got the posts and comments migrated into their respective tables. Now I need to get the comment count ...
0
votes
1answer
256 views

SQL query - get ids - Advanced Custom Fields / WPeC

I need to query the database on add_action( 'init', '...') to find post ids with the field 'product_discount_option' set to true. I know at least one of my product posts have the field ...
1
vote
2answers
1k views

Is It Possible to Restore Accidentally Deleted Widgets?

I accidentally deleted the widgets without dragging it to the inactive widgets section. I have a backup of all the files and the database but i have changed many things on the site other than the ...
0
votes
2answers
164 views

Wordpress $wpdb no result

I have the following code in my functions.php $code = 'EUR'; global $wpdb; $query = 'SELECT * FROM '; $query .= $wpdb->get_blog_prefix() . 'fxbase '; $query .= 'WHERE code= '.$code; $data = ...
2
votes
1answer
1k views

Check if post of title already exists

I'm writing a plugin that takes an xml feed and posts it into WordPress using wp-cron Everything is working dandy, except it keeps adding the same posts over again. So, I'm working on a system to ...
0
votes
2answers
145 views

How and where is wordpress adding mySQL content to database?

I am currently following this steps to change server and domain for my website. I have been exporting and importing mySQL from one data base to the other. I am about to delete the mySQL content of the ...
0
votes
1answer
91 views

Does WordPress cache get_user_meta() results?

If I call get_user_meta() to retrieve a value, does WordPress cache the value? If I call get_user_meta() to retrieve the same value, does WordPress have to query the database again or is it stored in ...
1
vote
0answers
275 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 ...
2
votes
1answer
628 views

How to disable `SQL_CALC_FOUND_ROWS` [duplicate]

Possible Duplicate: wordpress query causing load In the site I'm trying to optimize, I noticed several queries that are rather slow and start with SELECT SQL_CALC_FOUND_ROWS Searching this ...
2
votes
3answers
672 views

Programmatically changing role information; editing role name and deleting

I am making system where I am delegating a lot of functionality to the front end of a system using Wordpress. I have listed all the roles (most of the custom) and need to ability for a logged in user ...
1
vote
3answers
304 views

Delete post revisions on post publish

Is it possible to delete post/page revisions from the database when a post/page is published? 11/05/12 Answer: See the plugin below by bueltge I want to do this on a site with 5,000 posts and ...
0
votes
1answer
2k views

Change featured image urls in database

Im storing my images on another server and Ive managed to change the urls in the database but I cant seem to change the featured image urls? I will not be adding any more images so I just want to ...