The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Display Posts Pending Review in a WordPress Dashboard Widget

Shared by Alkesh Miyani · November 25, 2026 · @wp_dashboard_setup

11 views
1 upvote
Back to Snippets

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

  1. Add the code to your child theme’s functions.php file or a PHP snippets plugin.
  2. Log in as a WordPress Administrator or Editor with the edit_others_posts capability.
  3. Navigate to WordPress Admin → Dashboard → Home.
  4. Find the new Pending Review widget.
  5. 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

/**
 * 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

WordPress 7.1.5 WordPress Admin

Reported by the author on November 25, 2026. WPFolks has not verified this.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by