wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_dashboard_has_received_comments › WordPress Function

Since7.2.0
Deprecatedn/a
› _wp_dashboard_has_received_comments ( No parameters )
Access:
  • private
Returns:
  • (bool) Whether the site has received a comment.
Defined at:
Codex:

Determines whether the site has ever received a comment.

The result is persisted so the Recent Comments widget remains registered if all comments are later deleted, preserving its Screen Options and position.


Source

function _wp_dashboard_has_received_comments() {
	if ( get_option( 'dashboard_recent_comments_widget_registered' ) ) {
		return true;
	}

	$comment_count = wp_count_comments();

	if ( empty( $comment_count->all ) ) {
		return false;
	}

	update_option( 'dashboard_recent_comments_widget_registered', 1, false );

	return true;
}