akismet_spam_count

Definition:
function akismet_spam_count( $type = false ) {}

Parameters

  • $type

Source code

function akismet_spam_count( $type = false ) {

	global $wpdb;



	if ( !$type ) { // total

		$count = wp_cache_get( 'akismet_spam_count', 'widget' );

		if ( false === $count ) {

			if ( function_exists('wp_count_comments') ) {

				$count = wp_count_comments();

				$count = $count->spam;

			} else {

				$count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'");

			}

			wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 );

		}

		return $count;

	} elseif ( 'comments' == $type || 'comment' == $type ) { // comments

		$type = '';

	} else { // pingback, trackback, ...

		$type  = $wpdb->escape( $type );

	}



	return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type'");

}

489

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: