Prompting for review / reapproval of page content
-
16-10-2019 - |
Question
I have a fair amount of content in wordpress pages that gradually gets out of date over time. I can have an 'offline' process to set reminders in my calendar to remind me to review particular pages and bring them up to date.
However I was wondering if there is a way (with a plugin perhaps) to have WordPress put the pages into a 'needs review' state a certain amount of time after it was last edited. This would keep the page live, but prompts me to review the content.
Solution
I tend to look for simple solutions so my suggestion is to query pages, sort by modified day and display in Dashboard widget.
add_action( 'wp_dashboard_setup', 'add_old_pages_widget' );
function add_old_pages_widget() {
wp_add_dashboard_widget( 'oldpages', 'Oldest Pages', 'old_pages' );
}
function old_pages() {
$pages = get_pages( array(
'sort_column' => 'post_modified'
) );
echo '<ul>';
foreach ( $pages as $page) {
$edited = human_time_diff( strtotime($page->post_modified) );
$link = get_edit_post_link( $page->ID );
echo "<li><a href='{$link}'>{$page->post_title}</a> ( edited {$edited} ago )</li>";
}
echo '</ul>';
}
Can be modified to hide if no pages old enough, etc, etc.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange