Mit pixolins Tipp habe ich mir für mein WordPress Network quick and dirty ein kleines Plugin zusammengeschustert, dass genau meine Bedürfnisse erfüllt.
Für alle Interessierten:
<?php
/**
* Plugin Name: Update Post Reminder
* Description: Reminds you to update posts with a metabox on each post and a widget on the dashboard.
* Version: 1.0
* Author: Lennart Möller
* Author URI: https://www.lennartmoeller.com
*/
function display_update_post_reminder_widget() {
if (is_multisite() && is_main_site()) {
// search in all blogs in network
$blogs = get_sites();
foreach ($blogs as $blog) {
display_post_entries($blog);
}
restore_current_blog();
} else {
// search only in current blog
display_post_entries(get_current_blog_id());
}
}
function display_post_entries($blog) {
$today = date('Ymd');
switch_to_blog($blog->blog_id);
foreach (get_pages() as $page) {
$page_date = get_field("erinnerungsdatum", $page);
if ($page_date && $page_date < $today) {
echo "seit ".convertYmd(get_field("erinnerungsdatum", $page)).": ";
$editDomain = get_site_url($blog->blog_id)."/wp-admin/post.php?post=".$page->ID."&action=edit";
?>
<a href="<?php echo $editDomain ?>" target="_blank">
<?php echo get_the_title($page); ?><br>
</a>
<?php }
}
}
// Ymd to d.m.Y
function convertYmd($date) {
return substr($date,-2).".".substr($date,4,2).".".substr($date,0,4);
}
function add_dashboard_widgets() {
wp_add_dashboard_widget('update_post_reminder_widget', 'Seiten, die eventuell aktualisiert werden müssen', 'display_update_post_reminder_widget' );
}
add_action('wp_network_dashboard_setup', 'add_dashboard_widgets'); // add widget on Network Page
add_action('wp_dashboard_setup', 'add_dashboard_widgets'); // add widget on each blog
// Creates a Metabox on every page with a date input (ACF PHP output)
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5e8725d67562c',
'title' => 'Seite aktualisieren am',
'fields' => array(
array(
'key' => 'field_5e8725dda5ce9',
'label' => 'Erinnerungsdatum',
'name' => 'erinnerungsdatum',
'type' => 'date_picker',
'instructions' => 'Wähle ein Datum aus, ab dem du auf deinem Dashboard erinnert werden möchtest, dass diese Seite eine Aktualisierung benötigt.',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'display_format' => 'd.m.Y',
'return_format' => 'Ymd',
'first_day' => 1,
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
),
'menu_order' => 0,
'position' => 'side',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
?>