Filter hook 'xmlrpc_allow_anonymous_comments'

in WP Core File wp-includes/class-wp-xmlrpc-server.php at line 3927

View Source

xmlrpc_allow_anonymous_comments

Filter Hook
Description
Filters whether to allow anonymous comments over XML-RPC.

Hook Information

File Location wp-includes/class-wp-xmlrpc-server.php View on GitHub
Hook Type Filter
Line Number 3927

Hook Parameters

Type Name Description
bool $allow Whether to allow anonymous commenting via XML-RPC. Default false.

Usage Examples

Basic Usage
<?php
// Hook into xmlrpc_allow_anonymous_comments
add_filter('xmlrpc_allow_anonymous_comments', 'my_custom_filter', 10, 1);

function my_custom_filter($allow) {
    // Your custom filtering logic here
    return $allow;
}

Source Code Context

wp-includes/class-wp-xmlrpc-server.php:3927 - How this hook is used in WordPress core
<?php
3922  		 * @since 2.7.0
3923  		 *
3924  		 * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
3925  		 *                    Default false.
3926  		 */
3927  		$allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false );
3928  
3929  		$user = $this->login( $username, $password );
3930  
3931  		if ( ! $user ) {
3932  			$logged_in = false;

PHP Documentation

<?php
/**
		 * Filters whether to allow anonymous comments over XML-RPC.
		 *
		 * @since 2.7.0
		 *
		 * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
		 *                    Default false.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-xmlrpc-server.php
Related Hooks

Related hooks will be displayed here in future updates.