When multiple authors contribute to a WordPress website, editors and administrators often need to identify posts waiting for editorial approval.
This snippet adds a Pending Review widget to the WordPress Dashboard. It displays a list of posts awaiting review, including their titles, authors, and submission dates.
Editors can also access each pending post directly from the widget to review and edit its content.
How to use
- Add the code to your child theme’s
functions.phpfile or a PHP snippets plugin. - Log in as a WordPress Administrator or Editor with the
edit_others_postscapability. - Navigate to WordPress Admin → Dashboard → Home.
- Find the new Pending Review widget.
- Click any post title to open its editor.
Example dashboard output
Pending Review
| Post Title | Author | Submitted |
|---|---|---|
| Getting Started with WordPress | John Doe | 24 Nov 2026 |
| WordPress Development Tips | Jane Smith | 25 Nov 2026 |
| Understanding Gutenberg | Mike Dev | 25 Nov 2026 |
Example data only. The widget displays up to 10 pending posts, with older submissions first.
Notes
- Uses the WordPress
wp_dashboard_setupaction. - Uses
wp_add_dashboard_widget()to register the dashboard widget. - Retrieves posts with the
pendingstatus. - Displays the 10 oldest pending posts first.
- Requires the
edit_others_postscapability. - Provides direct editing links for individual posts.
- Does not approve, publish, or modify pending posts.
- Uses WordPress APIs and escaped output.
/**
* Register a Pending Review dashboard widget.
*/
add_action(
'wp_dashboard_setup',
'alkesh_register_pending_review_dashboard_widget'
);
function alkesh_register_pending_review_dashboard_widget() {
if ( ! current_user_can( 'edit_others_posts' ) ) {
return;
}
wp_add_dashboard_widget(
'alkesh_pending_review_widget',
__( 'Pending Review', 'alkesh' ),
'alkesh_display_pending_review_dashboard_widget'
);
}
/**
* Display posts awaiting editorial review.
*/
function alkesh_display_pending_review_dashboard_widget() {
if ( ! current_user_can( 'edit_others_posts' ) ) {
return;
}
$pending_posts = get_posts(
array(
'post_type' => 'post',
'post_status' => 'pending',
'posts_per_page' => 10,
'orderby' => 'date',
'order' => 'ASC',
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
)
);
if ( empty( $pending_posts ) ) {
echo '<p>';
esc_html_e(
'There are currently no posts waiting for review.',
'alkesh'
);
echo '</p>';
return;
}
echo '<ul>';
foreach ( $pending_posts as $pending_post ) {
$edit_link = get_edit_post_link( $pending_post->ID, '' );
if ( ! $edit_link ) {
continue;
}
$author_name = get_the_author_meta(
'display_name',
$pending_post->post_author
);
$submitted_date = get_date_from_gmt(
$pending_post->post_date_gmt,
get_option( 'date_format' ) . ' ' . get_option( 'time_format' )
);
echo '<li style="margin-bottom: 12px;">';
printf(
'<strong><a href="%1$s">%2$s</a></strong>',
esc_url( $edit_link ),
esc_html( get_the_title( $pending_post->ID ) )
);
echo '<br>';
printf(
'<small>%1$s: %2$s | %3$s: %4$s</small>',
esc_html__( 'Author', 'alkesh' ),
esc_html( $author_name ),
esc_html__( 'Submitted', 'alkesh' ),
esc_html( $submitted_date )
);
echo '</li>';
}
echo '</ul>';
if ( current_user_can( 'edit_posts' ) ) {
$pending_posts_url = add_query_arg(
array(
'post_status' => 'pending',
'post_type' => 'post',
),
admin_url( 'edit.php' )
);
printf(
'<p><a href="%1$s">%2$s</a></p>',
esc_url( $pending_posts_url ),
esc_html__( 'View all pending posts', 'alkesh' )
);
}
}
Tested on
Reported by the author on November 25, 2026. WPFolks has not verified this.
