wp_authenticate_spam_check

函数
wp_authenticate_spam_check ( $user )
参数
  • (WP_User|WP_Error|null) $user WP_User or WP_Error object from a previous callback. Default null.
    Required:
返回值
  • (WP_User|WP_Error) WP_User on success, WP_Error if the user is considered a spammer.
定义位置
相关方法
wp_authenticate_cookiewp_authenticatewp_authenticate_username_passwordwp_auth_checkwp_authenticate_email_password
引入
3.7.0
弃用
-

wp_authenticate_spam_check: 这个函数用于检查一个用户是否是垃圾邮件发送者。

对于多站点博客,检查认证用户是否被标记为垃圾邮件,或者用户的主博客是否被标记为垃圾邮件。

function wp_authenticate_spam_check( $user ) {
	if ( $user instanceof WP_User && is_multisite() ) {
		/**
		 * Filters whether the user has been marked as a spammer.
		 *
		 * @since 3.7.0
		 *
		 * @param bool    $spammed Whether the user is considered a spammer.
		 * @param WP_User $user    User to check against.
		 */
		$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );

		if ( $spammed ) {
			return new WP_Error( 'spammer_account', __( '<strong>Error:</strong> Your account has been marked as a spammer.' ) );
		}
	}
	return $user;
}

常见问题

FAQs
查看更多 >