How to disable comments on posts older than date X in WordPress

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'

Please rate this snippet

How to remove any post that is older than X days in WordPress

To remove any post that is older than X days in WordPress you can use the query below.

Sample mySQL

DELETE FROM wp_posts WHERE post_type = 'post' AND DATEDIFF(NOW(), post_date) > X

Please rate this snippet

How to disable or enable Trackbacks and Pingbacks in WordPress

To disable or enable Trackbacks and Pingbacks in WordPress you can use the following mysql queries.

Sample mySQL

enable

UPDATE wp_posts SET ping_status = 'open'; 

disable

UPDATE wp_posts SET ping_status = 'closed'; 

Please rate this snippet

How to change default Admin Username in WordPress

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';

Please rate this snippet

How to select top 10 reads per month in WordPress

To select top 10 reads per month in WordPress, you need to use the Plugin CountPerDay.
The following mysql snippet will do the rest.

Sample MySQL

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

Please rate this snippet