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

learn more… | top users | synonyms

0
votes
1answer
99 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
635 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
1answer
461 views

SQL query not working in alphabetical post title/content search

I have an ajax request using wp_ajax sending one variable named "q" what I want to do is after the script get's the request to look inside the db and fetch the title and id of the corresponding posts ...
0
votes
2answers
82 views

Problem with admin login after deployment

I made a site for a friend and everything worked so far on my development box that we can start final deployment and testing so I decided to put it on the hosting. So I done the standard procedure ...
0
votes
2answers
3k views

Query to delete all featured images and remove post meta?

I'd like to run an SQL query to find all featured images from posts and delete the file itself and any references to it. Can anyone tell me how to accomplish this? Many thanks!
0
votes
1answer
313 views

Find out how many times the user has logged in

I'd like to determine how many times a user has logged in. Does WordPress retain that information or will I have to add a db entry every time they log-in? if(is_user_logged_in() && ...
0
votes
1answer
426 views

Speeding SQL queries for a large database?

I am using a WordPress plugin called feedwordpress in order to run a planet like website on wordpress (See it here). The plugin is great except for one thing - it hogs down my (VPS) server into ...
0
votes
2answers
952 views

Configure Wordpress to connect to Mysql DB using SSH tunneling

Problem: Configure wordpress to use a remote mysql database only available using and SSH tunneling. Stage: I have a wordpress instance over an apache server on machine (called WP_server). WP_server, ...
0
votes
3answers
809 views

How to find if a post with custom_field == X exists?

I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?
0
votes
2answers
709 views

Have working sql query… trying to adjust it to use $wpdb

So I have this code that queries a custom plugin generated table in the wp database. It works perfectly as is. But I'm trying to adjust it to use $wpdb instead of the $con function I have set up. ...
0
votes
1answer
1k views

How can I SQL update a meta_value to remove the dollar signs that were entered with the value? (so just the value remains)

For all the "price" custom fields of a site, the dollar sign was entered with the value. I need to remove the dollar sign and leave the just the values. I know very little about SQL queries. The ...
0
votes
1answer
1k views

query users by role

I have a custom plugin which queries users and usermeta, but I now need to filter admins out of the results. A very simplified version of my sql query is: SELECT * FROM usermeta LEFT JOIN users ON ...
0
votes
2answers
1k views

Wordpress(wpdb class) and mysql stored procedures

$query = "CALL .........."; $result = $wpdb->get_results($query); print_r($results); Is returning an empty array and $wpdb->query does not return anything, how do you run stored procedures from ...
0
votes
1answer
28 views

Front end access to a SQL data repository - recommended way?

Building a general data repository, not necessarily related to WordPress elements. What is the recommended way of doing it: Using custom post types? or Building new SQL tables? Please elaborate. ...
0
votes
2answers
25 views

Custom Wordpress Table wpdb

running into issues querying a custom table and getting results. As of Wordpress 3.9, I can no longer run mysql_query(), and have to use $wpdb->query(); So keeping that in mind: Old Code: <?php ...
0
votes
2answers
36 views

How can I add a user through SQL?

By mistake I just ran this query: (note the extra ;) DELETE FROM wp_users; WHERE ID = 321; How can I add a user through SQL? I searched around but couldn't find a proper answer to this fairly ...
0
votes
2answers
227 views

How many Wordpress SQL Queries per page?

I am on a shared hosting which has a limitation at MySQL queries per hour. My shows unable to connect to database because of this. Can anyone tell me how many queries are per page on a wordpress site ...
0
votes
1answer
45 views

Which is better and faster ? Wordpress Queries or SQL Query

Suppose I am developing a minimal theme, the the post page single.php displays only the post title, the excerpt and the content. So in general that would be <?php the_title(); ?> <?php ...
0
votes
1answer
33 views

Active DB queries in Wordpress?

I just make some researches regarding to wordpress DB queries and I just wonder if I miss something a normal SELECT query for example in Codeigniter with active records would look like if I assume I ...
0
votes
1answer
29 views

Why this query is not showing any result on wordpresss home page?

I am learning wordpress database, And I have written this query for showing the data from the post table with id=2, but not showing anything. What is wrong with the following query? please help. ...
0
votes
2answers
2k views

Alternative to mysql_real_escape_string

I have a WordPress plugin that at one point I need to see if a certain title exists in the database. For 2 years, this code worked fine: $myposttitle= $wpdb->get_results( "select post_title ...
0
votes
1answer
42 views

Update postmeta after theme switch

I am trying to update the postmeta table when I switch themes. I am updating the metavalue to be template-name.themename.php. However, this only works with the default themes in wordpress. If I go ...
0
votes
1answer
91 views

Massive Tags Remove Using MySQL

I am using WordPress 3.4.2 for one of my site and currently it has 38,251 tags Now i want to remove all Tags from my site, so which way will be more safe to truncate every tags my site has.
0
votes
2answers
950 views

Different database query in function.php using mysqli

I am trying to connect to a database in the function.php using mysqli. The code seems to run fine when it is not on a separate php file not on wordpress. But when I run it on wordpress I get "Connect ...
0
votes
1answer
176 views

Updating User Meta with SQL Query

I have a Wordpress site that needed to have 9,000+ users imported to set up a Directory Listing. I imported them from an existing MySQL (non-wordpress) database and everything imported just fine. ...
0
votes
4answers
206 views

Strange wordpress slowness

I read a lot about my problem. I have 4 years old Wordpress (with newest 3.8.1 Wordpress) site. And last months it become really slow. It takes about 3-5seconds to render page. In administration area ...
0
votes
1answer
61 views

How to stop $wpdb from prepending database name

When I run an UPDATE query using $wpdb, WP prepends the database name associated with the WP installation to whatever is passed in the table name argument. This isn't desirable as my app passes the ...
0
votes
1answer
100 views

Is altering a default WordPress database table update safe?

I want to add some table columns to the wp_terms table. Is it safe to use the dbDelta function with a modified CREATE-MySQL query for this? Or will I run into problems in the long turn? Is it update ...
0
votes
1answer
767 views

Query multiple tables at once?

I want to query all of the posts in my WordPress multi-site set-up looking for a certain string. This is only being done in Sequel Pro (on the command line) for my own inquisitive purposes but there ...
0
votes
2answers
45 views

Mixing variables into an array when inserting values

I have a function that inserts a load of values into a database. Not a problem but I have a condition that changes the mysql statement. The problem is is the way wordpress constructs the statement, ...
0
votes
2answers
279 views

update image path with words starting uppercase to lowercase chars

I have to convert the image path to lowercase characters inside wp_posts table. Right now, I have inside my posts this: <img class="alignleft" title="my image title" alt="my image alt" ...
0
votes
1answer
62 views

Should I use Wordpress to skin a database website?

I am going to start programming a website which allows users to post adverts for aircraft for sale. (Think autotrader for planes). It will be free to use. There are a few websites that do this already ...
0
votes
1answer
163 views

php include not working in custom page

The Problem I have a db.php file which contains mysql login details. I want it in a separate file like this so it can be linked in several different pages for easier tracing later. This all works ...
0
votes
1answer
110 views

How do I display offsite database info on my wordpress site?

I host some online games from my personal computer which the game saves information to my Mysql database. I would like to display live data (if possible) on my hosted Wordpress site. I know the ...
0
votes
1answer
121 views

Best practice to limit results in get_row()?

This is my query to check if a title exists (it's in a loop, therefore [$i]). $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = '" . $titles_arr[$i] . "'", 'ARRAY_A'); Anyway, I would ...
0
votes
1answer
206 views

Creating Database Table vs. Adding MetaData to Post & User

I am creating some event functionality for my wordpress site. Each event will have a set of tickets associated with it. A user who is purchased at least one ticket will additionally have a set of ...
0
votes
2answers
166 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
2answers
161 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
3k 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 ...
0
votes
1answer
469 views

Force Users To Relogin

I need a solution that i can use to force a user to logout via the admin panel of word press any help on this would be appreciated.
0
votes
1answer
487 views

Custom SELECT Query With Multiple Meta Values (Ordering Problem)

I have two custom meta values that I am using for an events list and have almost got everything working perfectly except for the ordering. I have two dates (event_date and event_enddate). One of these ...
0
votes
4answers
3k views

Manually delete post from database

For whatever reason, I have a post and a page with the same slug name and it causes the db to hang. I can't alter the slug on either so I need to go manually delete the posts from the database and ...
0
votes
1answer
896 views

Importing Wordpress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin

I have been importing data records as posts with custom meta data directly into Wordpress via the CSV Importer plugin. It works okay, however, there are some issues with it. Issues: 1) It takes ...
0
votes
1answer
358 views

MySQL query performed 4 times inside loop

I have enabled custom php in my pages through the use of the exec-php plugin so I can run more complex pages than the standard WordPress page. I have had no problems with this plugin so far. I have ...
0
votes
1answer
1k views

Wordpress $wpdb get posts from category and sort by custom meta

I have a custom post type of 'events' which has a meta key 'event_date' Im using the following to retrieve those posts and arrange them by 'event_date' global $wpdb; $today = ...
0
votes
1answer
90 views

Wordpress tables and aliases?

I have imported some tables from my online wordpress database to my local to work on. However now I am getting some weird sql errors that I don't get online. I can see that the code of the plugin I ...
0
votes
2answers
2k views

How to remove duplicate Custom Fields?

I have migrated my blog from blogspot to WordPress. Then I have noticed many of the posts contain duplicate custom fields. Like blogger_author, blogger_permalink, blogger_blog are duplicated upto 5 ...
0
votes
1answer
48 views

What's the sql for this condition?

I want to delete all records from wp_usermeta with user_id whose meta_value is "tonetone" which is spam accounts. As you know already, there are many records with one user_id in wp_usermeta. I tried ...
0
votes
1answer
440 views

Wordpress and MySQL: trying to print data using PHP from user_meta custom field data

I have some custom user_meta fields in my MySQL database. The data is stored in my DB as follows: the meta_key is called "paypal_user" and the info is stored in the meta_value column as: ...
0
votes
1answer
378 views

Copy price categories to custom field

I have just made a big mistake today using a plugin to convert my 1000+ price custom fields into child categories under Price. I didn't know the custom fields will be deleted after the conversion. ...