+ 1
How to check if a page is older than say 30 days?
I know it's possible check if a post is a specific age, but I would like to do the same with a page in WordPress, to see if the page is older than 30 days, then trigger code... if ( page_age(30) ) { // Archive the page, hide it from visitors } else { // Keep it listed and available to visitors }
2 Respostas
0
save time when page is published.
then subtract it with current time...
var days = new Date(older-current);
var daysOld = days.getDay();
if(dayOld>30) return true;//30 days complete
else return false;
0
if you want for some reason sql command since you tagged sql
select * from poststable where postdate<'year-mm-dd';
where posttable is table where posts are kept and postdate is column with post date :)