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)

0
votes
2answers
70 views

Query is not work

I use this codes in my functions.php to track post views. /* Functions to track Post Views*/ function getPostViews($postID){ $count_key = 'post_views'; $count = get_post_meta($postID, $count_key, ...
0
votes
3answers
480 views

Migrated to Namecheap, now Trouble with Database & wp-config [closed]

I have been using a free web host while I set up my WP site. Now that it's all done I went and bought hosting from Namecheap. I uploaded the site and WordPress and everything seems to look fine, but ...
1
vote
1answer
919 views

WPML tables not deleted when removing multisite subsite, need help clearing up my sql-file! [closed]

I´m building a WP Multisite for a client that wants a multilingual site. Before choosing WP Multisite, I bought and tried out WPML. However that plugin didn't fit for the job so I deleted it and got a ...
0
votes
1answer
2k views

Using AJAX to run SQL statement and populate dropdown

I am trying to create a search where the user selects two different bits of data from the database and it then prints some results that meet requirements. I know I need to use AJAX, or something ...
-1
votes
1answer
405 views

SQL query add only posts with custom field to array

I have this SQL query which is building an array of wordpress posts... $query = "select $wpdb->posts.* from $wpdb->posts,$wpdb->terms,$wpdb->term_taxonomy,$wpdb->term_relationships ...
1
vote
0answers
195 views

Retrieve/get current image from Nextgen gallery db [closed]

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
508 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
79 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
509 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
223 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
321 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
975 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
51 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
352 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
81 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
451 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
121 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
300 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
166 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
466 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
182 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
388 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
97 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
371 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
298 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
132 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
63 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
75 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
8k 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
259 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
169 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
253 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
772 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
337 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
427 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
351 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
1k 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
5k 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
386 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 ...