To disable comments on posts older than date X in WordPress you can use the snippet below.
Sample mySQL
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2013-01-01' AND post_status = 'publish'
To disable comments on posts older than date X in WordPress you can use the snippet below.
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2013-01-01' AND post_status = 'publish'
To delete all unapproved comments in WordPress you can use the following snippet.
DELETE FROM wp_comments WHERE comment_approved = 0
To remove any post that is older than X days in WordPress you can use the query below.
DELETE FROM wp_posts WHERE post_type = 'post' AND DATEDIFF(NOW(), post_date) > X
To disable or enable Trackbacks and Pingbacks in WordPress you can use the following mysql queries.
enable
UPDATE wp_posts SET ping_status = 'open';
disable
UPDATE wp_posts SET ping_status = 'closed';
To identify unused tags in WordPress you can use the following snippet.
SELECT * From wp_terms terms INNER JOIN wp_term_taxonomy tax ON terms.term_id=tax.term_id WHERE tax.taxonomy='post_tag' AND tax.count=0;
To change user password in WordPress using MySql you can use the following query.
UPDATE wp_users SET user_pass = MD5('NewPassword') WHERE user_login = 'UserName';
To delete all pingbacks in WordPress you can use the mysql query below.
DELETE FROM wp_comments WHERE comment_type = 'pingback';
Every default WordPress installation will create an account with a default Admin username. This can be a security issue.
To change default Admin Username in WordPress you can use the mySql snippet below.
UPDATE wp_users SET user_login = 'NewUsername' WHERE user_login = 'Admin';
To select top 10 reads per month in WordPress, you need to use the Plugin CountPerDay.
The following mysql snippet will do the rest.
SELECT COUNT(page), wp_posts.post_title, wp_posts.post_name from wp_cpd_counter join wp_posts ON wp_posts.id = wp_cpd_counter.page WHERE wp_posts.post_date between '2014-06-01' AND '2014-06-30' GROUP BY page ORDER BY 1 desc LIMIT 10