wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_wp_dashboard_has_received_comments › WordPress Function

Seit7.2.0
Veraltetn/v
› _wp_dashboard_has_received_comments ( Keine Parameter )
Zugriff:
  • private
Gibt zurück:
  • (bool) Whether the site has received a comment.
Definiert in:
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.


Quellcode

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;
}