The sql tag has no wiki summary.
0
votes
1answer
66 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
150 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 ...
0
votes
1answer
496 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 ...
0
votes
2answers
322 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 ...
0
votes
2answers
2k 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 ...
1
vote
2answers
999 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
184 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
44 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
89 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
55 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
605 views
Export SQL query based on post type
I'm looking to export only wp_posts where post_type = post.
Is that possible?
1
vote
1answer
249 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:
...
0
votes
2answers
717 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 ...
0
votes
3answers
622 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 ...
1
vote
1answer
1k 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
164 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
348 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
216 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
389 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 ...
1
vote
3answers
163 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 ...
0
votes
2answers
735 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
623 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
3answers
3k 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
2answers
1k 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 ...
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:
...
2
votes
2answers
444 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]', ...
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 ...
0
votes
2answers
266 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 ...
0
votes
1answer
145 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
286 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
1answer
554 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 ...
3
votes
1answer
667 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 ...
0
votes
1answer
372 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
3answers
523 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
3k 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
// ...
0
votes
1answer
182 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
359 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 ...
0
votes
4answers
901 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 ...
2
votes
1answer
228 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 ...
0
votes
1answer
626 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 ...
3
votes
1answer
159 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
955 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 "
" ...
1
vote
1answer
761 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 ...
0
votes
1answer
581 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 ...
2
votes
2answers
1k 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
2k 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
369 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
1answer
185 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 ...
0
votes
3answers
325 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. ...