有时候是不会注意到有日志需要审核的,所以最好的办法就是在 WordPress 后台的首页(就是仪表盘)直接显示待审日志列表。

add_action(\'wp_dashboard_setup\', \'MBT_thread_modify_dashboard_widgets\' );
function MBT_thread_modify_dashboard_widgets() {
 global $wp_meta_boxes;
if(current_user_can(\'manage_options\')){ //只有管理员才能看到
 add_meta_box( \'pending_posts_dashboard_widget\', \'待审文章\', \'pending_posts_dashboard_widget_function\',\'dashboard\', \'normal\', \'core\' );
 }
}
function pending_posts_dashboard_widget_function() {
 global $wpdb;
 $pending_posts = $wpdb->get_results(\"SELECT * FROM {$wpdb->posts} WHERE post_status = \'pending\' and post_type=\'post\' ORDER BY post_modified DESC\");
echo \'<ul>\';
 foreach ($pending_posts as $pending_post){
 echo \'<li><a href=\"\'.admin_url().\'post.php?post=\'.$pending_post->ID.\'&action=edit\">\'.$pending_post->post_title.\'</a></li>\';
 }
 echo \'</ul>\';
}

发表回复

您的电子邮箱地址不会被公开。