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)

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 ...
2
votes
2answers
2k views

Improving WP_Query performance for multiple taxonomies

I have a site with several custom taxonomies, and have found that one of the slowest parts of the site is attempting to query with an OR across several of these at once. I'm using a WP_Query like so: ...
0
votes
1answer
171 views

How to export 2 week's worth of posts

I need to export the last two week's worth of blog posts from one site into another site, including all meta data and post author info. Is there a good SQL statement to do this, or a plugin that ...
1
vote
1answer
400 views

Importing Geo data into wordpress database

I have a listing wordpress site and want to integrate geo data into the Wordpress MySQL Database for custom search functionality I want to utilize different aspects to create different things... ...
2
votes
3answers
5k views

Pagination with custom SQL query

I have my own SQL string to select Custom Post Type posts with specific WHERE clause. I've used the offset and limit to return appropriate posts depending on a page being displayed. That's working ...
0
votes
1answer
700 views

How to retrieve sticky post in raw sql?

How I could made a sql query who retrieve all the sticky post in a wordpress database? This is because we use a new app over the old wordpress website database, and I don't know where Wordpress ...
2
votes
2answers
752 views

How to add SQL file with PHP to WordPress database [closed]

I have SQL file with US zip codes (over 41000 lines of code). I want make a plugin that inserts this SQL file into WP database so user can do a search by zip codes. I want to insert SQL with PHP ...
2
votes
2answers
166 views

How can I get a list of plugins and which blogs are using them?

I'm about to upgrade my Wordpress MU installation to wordpress 3 Before I update, I want to find out which blogs use which plugins. I don't see a way to do that in the UI, is there? What about a ...
2
votes
1answer
708 views

orphaned taxonomy terms remove by sql query

I have 3 custom post types each of these CPT's have posts that are set to auto delete via a given time scale by cron jobs, thing is when they are deleted it leaves behind orphaned taxonomy terms in ...
0
votes
1answer
409 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 ...
8
votes
2answers
13k views

WP_Query with “post_title LIKE 'something%'”?

I need to do a WP_Query with a LIKE on the post_title. I started with this regular WP_Query: $wp_query = new WP_Query( array ( 'post_type' => 'wp_exposants', ...
0
votes
1answer
219 views

How can I convert everything from category X to have post format Link

My "links" come in from Windows Live Writer, from a perl based delicious sync directly to the database and who knows where from. They all have in common that the category is 'Daily-Links'. So I think ...
2
votes
1answer
372 views

get posts and postmetas in assoc array

how do I get all posts and postmetas in an associative array? $allposts = $wpdb->get_results(" SELECT $wpdb->posts.post_title, $wpdb->postmeta.meta_key FROM $wpdb->posts JOIN ...
1
vote
1answer
276 views

Detect session/cookie variable in wordpress to prevent access to documents

<?php @session_start(); If (!array_key_exists(‘authed’, $_SESSION)) { include ‘not_authed.inc’; exit(); } // go about your business. ?> and i'm trying to add that to this: ...
3
votes
1answer
896 views

Is it possible to wrap Geo Location search around WP_Query?

I'll just like to add that I have a current working solution in place and works well but I'm looking for ideas of being able to do it better or cleaner if possible. We have hundreds of properties in ...
2
votes
1answer
256 views

Querying Email Addresses for a List of Users with Same Last Name?

I have a site with many users and many of them have the same last name. I want to get the emails of all the users with the same last name (IE: Smith) that has a post related to a particular taxonomy ...
2
votes
2answers
599 views

Use Cron to modify posts via sql

Hi to all I need to run this twice a day: UPDATE wp_posts SET post_content = REPLACE ( post_content, '[img]', '<img src="' ); UPDATE wp_posts SET post_content = REPLACE ( post_content, '[IMG]', ...
0
votes
1answer
466 views

latency problems with wordpress install (from SQL import)

I develop wordpress sites for a living, and today I am experiencing something that I haven't yet come across: Extremely slow load times / latency problems. You can view the site here: ...
0
votes
1answer
861 views

Can Anyone provide an example of RAW SQL for SELECTING posts by 2 or more tags

I need a RAW SQL, as I am working from different platform with WordPress Database. When I run example.com/tag/first+second, WordPress runs a query SELECT post_id, meta_key, meta_value FROM ...
12
votes
3answers
369 views

What are the common security flaws I need to look for? [closed]

As a wannabe WP plugin developper, what are the main security flaws/holes I should look for? I'm about to create a new plugin with a configuration panel (ie input fields and stuff). What should I be ...
3
votes
1answer
176 views

How to make an activities stream mixing posts and comments?

What I'm currently trying to make is an activities stream wich list : The posts, the comments, both mixed between them and ordered by date. My idea is to make two queries, but i don't know how to ...
1
vote
1answer
1k views

Order query by meta_value with multiple custom fields

I would like to get ordered all my posts with multiple cutom fields (WordPress 3). Exemple, I've 2 custom couple meta_key/meta_value : " order_submenuexpositions / numeric " " ...
0
votes
4answers
1k views

I need a SQL command to delete specific authors and all posts connected with them

I unfortunately have authors with a lot of unreadable/spam posts published (thousands some of them) I have tried deleting through admin,but its a slow painful process-does anyone have a specific SQL ...
0
votes
1answer
676 views

Troubles about insering a POST with a SQL query, post_status

I 'm using wordpress 3.0.5 I have to use sql for create post, here is my SQL query: $req = $bdd->prepare('INSERT INTO wp_posts ...
4
votes
3answers
5k views

How do you properly prepare a %LIKE% SQL statement?

I'd like to use a LIKE %text% statement while still using the WordPress $wpdb class to sanitize and prepare input. SELECT column_1 from `prefix_my_table` WHERE column_2 LIKE '%something%'; I've ...
6
votes
6answers
28k views

What SQL Query to do a simple find and replace

Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a ...
0
votes
1answer
2k views

Overriding default calendar to show posts from a category

I'm trying to modify the default WP calendar (get_calendar()) so that it shows posts from a specific category and then use that as a shortcode. Here's what I've done: Copied across the ...
2
votes
2answers
2k views

Alter query on edit.php

What's the best way to alter the query being run on the Posts Edit screen (edit.php)? The current method I'm using is by passing an argument to the global $wp_query like so: $wp_query->query( ...
2
votes
2answers
3k views

Query between two meta values?

How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like: meta_key | meta_value | ------------------------| start_date | 20100131 | //Jan ...
1
vote
1answer
854 views

Modify Wordpress SQL Query to pull from within a category

I am using a wordpress plugin called "kf most read" which stores a count of how many times a post was read, and lets you output a list of most read posts. This works well. The issue is, I am trying ...
1
vote
1answer
419 views

Best Way to Merge a Dev and Live Site to Become a Staging Site?

I have two Wordpress installs, both with a little bit of different data. I have a LIVE site and I have a DEV Site. I need to merge the content of these two databases together to make a STAGING Site. ...
0
votes
2answers
4k views

Scanning Database for malicious Data

After a site of a friend has been hacked I told him he should just clean up the mess and restart from scratch so he know that no file has been altered. I could scan the site for him with tools like ...
0
votes
1answer
218 views

Total number of posts in last year

How can i echo total number of posts in last year ? I‚m writing article with stats, and want to get number of posts i published last year. There is something here, but not for last year ...
1
vote
1answer
86 views

Get the most repeated post contents from a search?

In my site the posts content is always the name of a school, so if I search for Chicago I get a lot of posts with different schools as content. What I want to do is to get the Schools with the most ...
4
votes
2answers
3k views

How to correctly call custom field dates into a posts_where filter using SQL statements

Currently I have the loop listing posts between two dates using the posts_where filter: function filter_where( $where = '' ) { $where .= " AND post_date >= '2000-01-01' AND post_date <= ...
0
votes
3answers
722 views

Code to remove authors with no posts connected to them

I am looking for SQL code that I can run from phpmyadmin to remove all registered users on the blog that do not have any post associated with them.
0
votes
3answers
750 views

How do I move a Wordpress site to another server?

i'm using this sql.. but it does not work UPDATE wp_options SET option_value = replace(option_value, 'http://old.com, 'http://new.com') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE ...
0
votes
3answers
338 views

Problems with moving my Wordpress site to another domain/server

I'm having problems moving a wordpress site from one domain to another. I've searched the site but couldn find a useful answer for my situation. Here's what i did: I made a backup of the website. ...
20
votes
5answers
35k views

How to display sql query that ran in query?

I have come across a function before that displayed the exact SQL code that was used in a loop for example, but can't remember. Can anybody tell me that function? Cheers
0
votes
3answers
4k views

Authors list Pagination : result set from $wpdb->get_results()

Using this solution : Paginate result set from $wpdb->get_results() I did make my code for Authors list page template as follow: <div> <table id="mytable"><tbody> <?php // ...