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
1answer
268 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
650 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
492 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
969 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 ...
13
votes
3answers
416 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
191 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
733 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
7k 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 ...
7
votes
6answers
34k 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
3k 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
894 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
437 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
5k 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
229 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
88 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 ...
5
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
780 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
778 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. ...
23
votes
5answers
45k 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
5k 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 // ...