SQL (Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS).

learn more… | top users | synonyms (1)

1
vote
0answers
192 views

Retrieve/get current image from Nextgen gallery db

I thought that I can do it using the database where the idea was to get the image from the ngg_gallery_pictures table, where the browser URL is equal to URL of the image in the table. Then I will get ...
0
votes
1answer
484 views

SQL Query members by profile fields Buddypress [closed]

i am trying to add a profile based search option into my existing plugin. my plugin already search members by distance within a certain radius and i want to add the option to filter results by profile ...
0
votes
1answer
70 views

List recent 25 blogs across the network

I need to list recent 25 blogs in the network with their title. How to edit this code ? $bcount = get_blog_count(); global $wpdb; $blogs = $wpdb->get_results($wpdb->prepare("SELECT * FROM ...
3
votes
2answers
466 views

Sharing database for collaborative development

Is there a straightforward way to share/sync multiple WP instances with a single database? I work collaboratively with several developers on custom themed sites. We use git to keep our files in order ...
0
votes
1answer
221 views

Show array of meta_value in Edit Post Coloum

what I'm trying to do is add a new coloumn to Edit post page (done) and in that coloumn show data taken from a set of custom fields (partially done). This is my code (I use it as a plugin so it ...
2
votes
1answer
308 views

Bulk add tag (or any sort of label) to posts who have custom excerpt

The situation is the following: The blog as of now has 2200+ posts. In the beginning (2007/2008) I was using manual excerpts where I would put an image and a little bit of text. The manual excerpt ...
3
votes
3answers
2k views

SELECT max(meta_value) FROM wp_postmeta WHERE meta_key='price'… stops working when value is over 999

Overview: I am not trying to return a post. I simply want the single highest value for a particular meta_value across all posts... just the value itself. Details: I have added a custom meta_key ...
2
votes
1answer
910 views

get_results on large datasets

I am experimenting some very disturbing problem using a custom SQL query. I have a custom MySQL table called trading_datas having 165 lines for 4,4Mo. One field datas of my table is a big serialized ...
0
votes
1answer
50 views

post id not displaying

I have used this code in header.php ### get the author info global $current_user; get_currentuserinfo(); $authorid = $current_user->ID; ### get the last post id using author id ...
0
votes
1answer
348 views

Alter SQL query to return posts with unique custom field value, no duplicate values

I currently have a list of posts with the custom field "Name," with several posts having the same value for "Name." I would like to retrieve a list of posts that all have unique values for "Name." ...
1
vote
3answers
2k views

How do I add indexes to Wordpress Database?

I got a message from Hostgator about my account being suspended because of the load it put on their servers. This is about the fifth time this has happened. I am on a shared server. And they said it ...
-1
votes
1answer
78 views

Adding profile data to database

I added a custom field to my wordpress user profile page that asks a user what their favorite browser is. I have the field on the profile.php page, but how can I get this field into my sql database? ...
0
votes
1answer
413 views

How to get from sql query page id and retrieve it url and title

Conditions: Page have template, for example: /* Template name: News */ Explaining: We have many pages, and one page with assigned template (/* Template name: News */). I want on main page ...
1
vote
1answer
118 views

Get the timout value of a saved transient?

Does anyone know if there is a Wordpress function to get the timeout value of a saved transient? I am using a transient with a 5 minute timeout to cache data from a web API call locally. Between ...
3
votes
2answers
3k views

Retrieving custom fields with $wpdb->get_results

I'm trying to use $wpdb->get_results to retrieve an array of all posts including custom fields. I can retrieve the meta_key and meta_value columns like this: [meta_key] => state [meta_value] ...
0
votes
2answers
291 views

Fetching review value using wpdb class

I'm generating an XML file using PHP for a website where they review tech products. In the XML file, I have to display the rating of products. For rating purposes, I'm using GD Star Rating plugin. ...
1
vote
1answer
161 views

$wpdb get_var issue

I've been at this for while, but can't figure out why the below isn't working. I have my date saved as a 'MM/DD/YYYY' string. global $wpdb; $new_day = $day->format("m/d/Y"); $qty = ...
0
votes
1answer
448 views

Remove password protection from all posts

So I messed up my blog (QBobble). I had an SQL backup, fortunately, so I reinstalled Wordpress, and imported my SQL database. Unfortunately, it password protected all of my posts. I know that I can ...
3
votes
1answer
173 views

How should I intercept the main query and inject custom join / order by / group by criteria

I have a CPT that is a member of two separate taxonomies. On the taxonomy archive page for one of the taxonomies, I need to further group and sort on the second taxonomy like so: ...
2
votes
2answers
382 views

Moving database with phpMyAdmin

I have a remote (website) version of a wordpress site and it's got more recent information than my local (computer) version. I would like to move the data over to my local using phpMyAdmin, what is ...
0
votes
1answer
43 views

How to migrate a database from a server to another

I try the export method of phpmyadmin, but the user is exported with the data... so there is no way to re import it into another database without error message. The old user is name : ...
0
votes
1answer
96 views

Proper approach to moving complete site from one domain to another AND preserve widgets

I consider myself fairly versed in this matter, however I've recently had a rash of issues when moving sites. I am able to successfully move the site, edit wp-config.php, move the database, etc. ...
0
votes
2answers
362 views

Get comments after specific date

I don't think this is a parameter in get_comments( $args ); so I'm using a SQL statement. First I obtain a comment date from a separate table I created. Afterwards, I want to retrieve all comments ...
1
vote
2answers
2k views

Export entries and multiple custom field meta to .csv?

First time poster. I'm trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I've ran the native export to xml, but it's not the correct format I ...
1
vote
0answers
282 views

Why is my 'list_terms_exclusions' filter function timing out? [closed]

Why is my function timing out? When the issue was first noticed I added wp_defer_term_counting('true') to delay that process but to no avail. /* Filter category from get_categories and ...
0
votes
1answer
46 views

Removing posts by sql

Often i build a site and we have test posts. I was wondering if there's a way via sql to drop all the blog posts with a simple sql query. Obviously, I would have backed up my previous database before ...
0
votes
3answers
130 views

quotes problem in very simple sql

I just simply want to execute a SQL sentence inside of a post (i am using EXEC-PHP widget for that). The problem are the quotes when i want to do something like $my_name='hello' "select * from ...
0
votes
1answer
62 views

Exporting by table

I am using PHPmyAdmin to move a site. My site is too large to use the single file export/import method. (I know how to do it, it works fine on smaller sites.) It seems the only thing working for me ...
0
votes
1answer
73 views

How can I get posts from 9/13/11 to today with SQL? [closed]

I have been working with a client to redesign his site and we are at the stage where we are going live, except I'm running into a little problem. Time is of the essence, as the deadline is mid-day ...
0
votes
1answer
1k views

Export SQL query based on post type

I'm looking to export only wp_posts where post_type = post. Is that possible?
5
votes
5answers
7k views

Most efficient way to get posts with postmeta

I need to get a bunch of posts with their metadata. Of course you can't get metadata with a standard posts query, so you generally have to do a get_post_custom() for each post. I'm trying with one ...
1
vote
1answer
248 views

Location-Based Pages displaying results near customer

I'm creating a website where the customer will enter their postal code and the pages (with a distance selected of 5, 10, 20 miles) will display on either a Google map or Bing map. The page results ...
0
votes
2answers
164 views

Assign a list of categories with a parent category

I imported hundreds of locations and other categories. Now I have a list of locations in categories to which I would like to assign the "Location" category as its parent. I have tried sql but the ...
1
vote
1answer
2k views

Add Admin User via SQL

I gave my client the admin account to his wordpress install and I forgot to add an administrator user for myself. Now, I can no longer access the admin panel because they have changed their password. ...
2
votes
1answer
247 views

Multipart/formatted MySQL query problem

I'm creating a plugin and I want to automate the creation of a MySQL Trigger on a table. The problem seems to be that $wpdb->query doesn't appear to accept either multipart statements and/or formatted ...
1
vote
1answer
732 views

Preferred Method of debugging a wordpress SQL calls?

What is your preferred method of debugging Wordpress Applications when writing custom behind-the-scenes SQL calls, etc. ? Coming from a Rails background, I usually tail a log file that displays not ...
0
votes
2answers
324 views

Wordpress Categories: Function using custom SQL to return array of specific category IDs

I'm developing a custom theme which uses categories for positioning, all of which begin with an underscore (e.g. _position1). I have an SQL query as below to get a list of these categories (those ...
0
votes
2answers
422 views

wordpress sql posts query won't display the latest post in a specific category

Hi I tried to display 5 posts titles from a specific category also show the date, but it won't display the most recent one that just published, I had to change the recent post date 2 months so it'd ...
1
vote
4answers
327 views

Retrieving a Value from a wp-database

why my sql statement is not returning any value.. is this wrong? <?php global $wpdb; $result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ...
2
votes
2answers
1k views

How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. Question 1 I am ...
0
votes
2answers
2k views

SQL select of users by metadata

Hi I'm trying to select users with a particular role only, using the following sql statement... SELECT DISTINCT ID, u.user_login, u.user_nicename, u.user_email FROM wp_users u, wp_usermeta m WHERE ...
0
votes
2answers
996 views

export individual posts to text files or a single csv file

I'd like to export my blog posts to plain text files so I can version control and update them using emacs org-mode via the org2blog package. However, I'm unfamiliar with SQL and the wordpress ...
2
votes
2answers
4k views

What's the easiest way to duplicate an entire navigation menu?

What's the easiest way to duplicate an entire navigation menu? I don't care if it involves SQL commands or whatnot. I just have some really big menus that I'd like to duplicate. Didn't see a plugin to ...
0
votes
2answers
384 views

Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories

I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories ...
3
votes
2answers
2k views

SQL query to extract only the “current” wp_posts?

The wp_posts table seems to retain all revisions of the same, ok very similar but presumably different, posts/pages/whatever. I'm somewhat conversant with SQL but not WordPress. I need to extract ...
3
votes
2answers
752 views

Display only certain posts based on visitor's country?

Is it theoretically possible to have the following feature? Each post has a country code. When a visitor comes in, the system will determine the visitor's country code. Then when the page renders, ...
2
votes
2answers
2k views

How to set up default values for a plugin?

What is the best way to go about setting up default values for a plugin? Should I just insert those values into the wp_options table? AND...if that's the best way to go about it, I have another ...
7
votes
1answer
3k views

Making my plugin multi-site compatible

I want my plugin to be installed on each blog and create database tables per blog. I have this code: register_activation_hook( __FILE__, 'install1' ); function install1() { global $wpdb; if ...
0
votes
2answers
340 views

Moving an entire wordpress site from one domain to a new domain and database

I have done all the steps requiered to import the dump.sql file to new database, and copiey the entire content from the old domain over to the new one. When i login to mydomain/wp-admin, i'm ...
2
votes
2answers
2k views

Import old SQL dump into new Wordpress version

I'm trying to restore a Wordpress blog from a backup. Unfortunately, all I have is an SQL dump of the database as generated by phpMyAdmin. The dump was created when the blog was running Wordpress ...