SQL Command for Clean up your WordPress Database

Delete all post revisions and their metadata

DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);

Delete all unused post tags

DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 );
DELETE FROM wp_term_taxonomy WHERE term_id not IN (SELECT term_id FROM wp_terms);
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);

Delete specific post meta

DELETE FROM wp_postmeta WHERE meta_key = 'YourMetaKey';

Clean up wp_commentmeta entries which have no relation to wp_comments

SELECT * FROM wp_commentmeta WHERE comment_id
NOT IN (
SELECT comment_id
FROM wp_comments
);
DELETE FROM wp_commentmeta WHERE comment_id
NOT IN (
SELECT comment_id
FROM wp_comments
);

Delete Post without article

DELETE FROM wp_posts
WHERE post_type = 'post'
AND post_content= ''

Post Tags : delete all post revisions and their metadata wordpress database, delete all post revisions and their metadata in wordpress database.

Cara Pindah File antar Server menggunakan putty (SSH)

Download putty disini:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

– Buka Putty.exe, masukkan Host Name or IP Address Port diisi 22
– Tekan Open, kemudian masukkan user login, Enter
– Masukkan Password, tekan enter
– Muncul user@domain.com [~]#
– Ketik “dir” (tanpa tanda petik), untuk melihat directori apa aja yg ada dalam server
– ketik cd public_html [artinya change directory to public_html]
– ketik wget http://tempatdonlot.com/blablabla.zip , klik enter, untuk medonlot file tersebut ke server kita
– Beresss…

Remove Duplicate From WordPress Quickly

Remove Duplicate From WordPress Quickly,
This is simple, Login to cpanel, and the go to phpmyadmin
Select your Blog’s mySQL database Account, (You will see a list of tables within that database). Click on SQL
Copy-past below given SQL command and click on Go:

DELETE bad_rows.*
from wp_posts as bad_rows
inner join (
select post_title, MIN(id) as min_id
from wp_posts
group by post_title
having count(*) > 1
) as good_rows on good_rows.post_title = bad_rows.post_title
and good_rows.min_id <> bad_rows.id

Now Just wait for about a few minutes and All your Duplicate Posts will be removed magically.