How to reload or rerender the page using AngularJS

To reload or rerender the page using AngularJS you can use the snippet below.

Sample AngularJS

$route.reload();

Please rate this snippet

How to check if an array contains a value in Javascript

To check if an array contains a value in Javascript you can use the snippet below.

Sample Javascript

Array.prototype.inArray = function (inputValue) {
	var counter;
	for (counter=0; counter < this.length; counter++) {
		if (this[counter] === inputValue) {
			return true;
		}
	}
	return false;
};

Please rate this snippet

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