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

learn more… | top users | synonyms

1
vote
2answers
738 views

How to create another version of my site based on the same database

I have created a site and would like to create another version of the same site using the same exact database (db location, users, everything). The two sites would share one database. I already have ...
1
vote
2answers
245 views

greatest() function returns undefined property

I'm using the mysql GREATEST() function to compare two table fields and display in a loop either one with the highest integer value. The 2 fields consist of vote scores for posts: UP or DOWN. ...
1
vote
3answers
1k views

Convert wordpress posts to products in Woocommerce

Is there anyway I could convert all the posts e have right now on our Worpdress install into products using some mysql query or something like that?
1
vote
1answer
492 views

Universal problem: first request after ~25 second inactivity always slower (~1 second) than subsequent requests (~1/10sec)

It's something I noticed ever since I started working with WordPress. It's a universal issue, in the sense that it doesn't matter if the WP installation is on my shared hosting account (haven't tried ...
1
vote
3answers
344 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 ...
1
vote
1answer
768 views

the_author_meta not working

I'm trying to use the_author_meta to retrieve some links which users can set in their profile. I set up extra profile fields and they are saving to the database. On my author.php I have the ...
1
vote
5answers
6k views

Will it break my site if I delete all transient records in wp_options table?

My site currently has an outrageous 500k+ transient records in the wp_options table. This causes the table to be crashed frequently and so be my site. I thought transient records will all expired ...
1
vote
2answers
460 views

Mysql query LIKE not working

I'm using this code. $blog_list = $wpdb->get_results( "SELECT " . $extra . "blog_id, last_updated FROM " . $wpdb->blogs. " WHERE public = '1' AND archived = '0' AND mature = '0' AND spam = '0' ...
1
vote
3answers
1k views

MySQL query to set wp_postmeta using term_taxonomy_id value

I have a need to set the wp_postmeta value (in table: wp_postmeta) on every post that has a specific term_taxonomy_id (in table: wp_term_relationships): Specifically: run a query against every ...
1
vote
1answer
336 views

Rewrite database urls

Is there a query I can run on my wordpress database so that I can change all instances of www.mydomain.com to localhost/mylocalsite.com?
1
vote
1answer
149 views

HTML Entities in Post Title

I'm inserting posts into wordpress using a script which is loaded through CRON. Before inserting each post I am checking whether the post with the same title exists or not. Below is the snippet I'm ...
1
vote
1answer
614 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 ...
1
vote
2answers
393 views

How to create and work with custom data / tables (i.e., for arbitrary data)?

Getting started on Wordpress just today. I noticed that Wordpress created tables in a mySql database (with name *.wrdp1) when I first set it up. These tables cover comments, posts, users, and some ...
1
vote
2answers
6k views

Get Featured Image via direct sql query

I know you can use the wordpress methods for getting a featured image, however with this particular project I need to get the featured image via mysql query. Can anyone point me in the right ...
1
vote
1answer
696 views

Within the database, where is the flag which says that a user has Super Admin rights?

I have an user in a Wordpress Multisite installation and have access to the Mysql database, I would like to give myself super-admin rights to access the wp-admin/network page. Where can I do it on ...
1
vote
3answers
1k views

Import 10,000 Users into Wordpress WITH a specific ID for each user

I have a website which has about 10,000 users. I am converting this site over to Wordpress. The new site is ready to roll, but I have to bring over all the users. There are a number of plugins ...
1
vote
1answer
565 views

Is it possible to split database tables using HyperDB?

I'm looking for an answer from someone who's implemented HyperDB or has knowledge of it. I have a database which has just passed the 100mb mark a week or so ago, the problem is my host only allows ...
1
vote
1answer
412 views

Disallow categories from this MySQL query

I'm trying to modify a plugin that generates an archive listing so it shows only one category, making it a single category archive. The old version of the plugin used a get_posts query, and so it was ...
1
vote
3answers
329 views

Performance on WPMS

my WPMS site is hosted on 8 cores/32mb RAM server but the response time is very high. We have about 1000 blogs (35,000+ tables on single db) and 70,000 pageviews per mounth. I think that i can down ...
1
vote
3answers
944 views

importing users where password is provided as md5 + much metadata

I have a spreadsheet that was provided to me of users to import to a new site I have built. I was provided with the password in MD5 hash form. I suspect if I insert this into the password field in ...
1
vote
1answer
203 views

WP database error for comments_popup_link()

I'm using the comments_popup_link() function to show the number of comments for each post in a loop. <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if ( ...
1
vote
1answer
673 views

Adding new row to wp_post table

I want to add 2 more rows (for voting up or down) to my default wordpress posts table. Would those rows be deleted when I update my WP version, or cause any other problem? An alternative would be to ...
1
vote
1answer
119 views

Wordpress database error - Error in SQL syntax - I can't identify any error?

I am trying to write function that checks whether an email address is stored in my database or not. I've written the following PHP code:: function check_my_users( $email_address ) { global ...
1
vote
1answer
26 views

Why doesn't this code add a table to my database?

To get to the point, I'm trying to add a database table upon installation of my plugin. Here's my code: global $scimp_db_version; $scimp_db_version = "1.0"; function scimp_install () { global ...
1
vote
1answer
97 views

How to determine what is generating large amount of database queries?

For some reason, my Wordpress site is using a lot of memory (spiking at 72MB) and generating a huge amount of database queries (76923 according to Wp-Memory-Usage. I'm really not sure why this would ...
1
vote
1answer
375 views

Successful or Error Message after running mysql code in functions.php

Just for this article, suppose there is a code that I want to run on my WordPress' functions.php file. It's a code to delete mysql table on my database. For example, here's the code: $wpdb->query( ...
1
vote
1answer
676 views

Can I use MariaDB instead of MySQL in wordpress?

Is it possible to use MariaDB instead of MySQL in Wordpress installation? If possible: how do I do that? Is there any drawback or complexities?
1
vote
1answer
27 views

For best DB performance should I serialize all theme options together or by type?

If my theme has a lot of options is it better to store all options in one database entry, or to use a databse entry for each group of options? IE would I name all options like this ...
1
vote
1answer
141 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 ...
1
vote
2answers
417 views

$wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies

It's easier if I made an example: I have a custom post type MYPOSTTYPE, with 3 taxonomies TAX_1, TAX_2 and TAX_3 If I have 3 terms: 'TERM_TAX_1' in TAX_1, 'TERM_TAX_2' in TAX_2, and 'TERM_TAX_3' in ...
1
vote
2answers
259 views

Join new table with SQL query

I created a plugin with a new table (wp_soundcloud) and I need to retrieve the data from that new table along with the post data. Here is my query: $querystr = " SELECT $wpdb->posts.*, ...
1
vote
2answers
285 views

Distinction on meta value on pre_get_posts

I've got a special "position" meta field for posts which can be between 0 and 37. 0 Is ignored, and everything else can have obviously any number between and including 1 and 37. But this of course ...
1
vote
1answer
1k views

tag search using WP_Query

I need to find only posts with a tag forest gump. I've tried: new WP_Query('tag=forest+gump');, new WP_Query('tag=forest gump');. However they both return ALL the posts and not only the posts with ...
1
vote
3answers
691 views

WordPress Custom Query

I have posts that use a custom field for start date and end date. query_posts returns an array of posts that exist in the category I'm filtering. How do I query posts using this custom field that has ...
1
vote
1answer
941 views

Split WP install between 2 databases?

Is it possible for Wordpress to work from two databases? The reason I ask is that we're approaching our 100mb limit for database size on our host (1and1) but have up to 100 databases, so what I was ...
1
vote
1answer
1k views

Tags to Post-ID mysql query. Tag Search

Im trying to implement a tag-based search. When i specify certain tags, tagged posts will be searched and the post-id will be displayed that matches the searchcriteria. Currently it only works for a ...
1
vote
1answer
366 views

MySql database help for a plugin

I am using a WordPress plugin called MyReview but I want some changes to it. That plugin has feature to review posts, where users will come and give star ratings to the post according to categories, ...
1
vote
1answer
390 views

if statement on database query

Part of a voting script I'm working on: I'm checking a custom table in my WP database to see if a user already voted for a post by checking the IP address and the post id. If the user's IP already ...
1
vote
2answers
73 views

Add “Category” to Mysql Query

i need your help :) I've made this custom Mysql query on WordPress: $querystr = " SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id IN( SELECT DISTINCT ...
1
vote
1answer
80 views

wpdb insert and boolean fields

I'm preparing an insert query like this: $wpdb->insert('table', $data, $format); data array will be: $data = array_push($data, 'resp' => true) problem is, what $format shall i use for a ...
1
vote
2answers
65 views

Single meta_query query using OR instead of AND in request's WHERE statement

I want the native WordPress search input to search metadata in addition to its standard title and content search, however setting a meta_query adds an AND clause to the request when what I need is an ...
1
vote
1answer
27 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 ...
1
vote
1answer
33 views

I want to select the from values from database in WordPress? [closed]

Here is my code: $sql = 'SELECT * FROM ' . $wpdb->base_prefix . 'item WHERE uname = "'. $_POST['login_name'] . '" '; $result = $wpdb->get_results($sql) or die(mysql_error()); foreach($result as ...
1
vote
1answer
44 views

Wordpress not reflecting changed of the database

my problems started when I moved my website to another folder (from /dev/ to /). I have gone through the whole database in order to change all the hardcoded /dev/ into / but I still notice that ...
1
vote
2answers
443 views

how to refresh wordpress permalink settings? (without admin panel)

I changed permalinks in wp_options table in database and I'm getting 404 on every post. Everything works fine after I log in into the panel and click "save settings" on permalinks options page. How ...
1
vote
1answer
35 views

Migrating from Existing MySQL Setup to WordPress

I currently have a database with the following schema: Table: Articles Columns: ID, Title, Author, Content Table: Authors Columns: ID, AuthorName, EmailAddress Table: Categories Columns: ID, ...
1
vote
1answer
428 views

SQL query to update post_date (one post = one single date & time)

I have 120 posts of one category ready for my wordpress blog. For the moment, posts are drafts and I don't want to schedule them manually. I want to publish them like this: 4 articles each day from ...
1
vote
2answers
270 views

Connect another DB and fetch records from some tables

I want to connect with another wp db & then fetch records from new connected db then close that db. I follow How can I connect to another WP database and use WP_Query? but after connect to new db ...
1
vote
1answer
674 views

Bad Request (Invalid Hostname) on working server, database problem

I have a local server up using EasyPHP. I know its working because I have a default wordpress install running and up on my brower. I have a full site which I also know I have working because when I ...
1
vote
1answer
199 views

Mysql query and order meta value

I made a mysql query to WordPress like this: $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND ...