Filter hook 'xmlrpc_enabled'

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

View Source

xmlrpc_enabled

Filter Hook
Description
Filters whether XML-RPC methods requiring authentication are enabled. Contrary to the way it's named, this filter does not control whether XML-RPC is *fully* enabled, rather, it only controls whether XML-RPC methods requiring authentication - such as for publishing purposes - are enabled. Further, the filter does not control whether pingbacks or other custom endpoints that don't require authentication are enabled. This behavior is expected, and due to how parity was matched with the `enable_xmlrpc` UI option the filter replaced when it was introduced in 3.5. To disable XML-RPC methods that require authentication, use: add_filter( 'xmlrpc_enabled', '__return_false' ); For more granular control over all XML-RPC methods and requests, see the {@see 'xmlrpc_methods'} and {@see 'xmlrpc_element_limit'} hooks.

Hook Information

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

Hook Parameters

Type Name Description
bool $is_enabled Whether XML-RPC is enabled. Default true.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-xmlrpc-server.php:221 - How this hook is used in WordPress core
<?php
 216  		 *
 217  		 * @since 3.5.0
 218  		 *
 219  		 * @param bool $is_enabled Whether XML-RPC is enabled. Default true.
 220  		 */
 221  		$this->is_enabled = apply_filters( 'xmlrpc_enabled', $is_enabled );
 222  	}
 223  
 224  	/**
 225  	 * Makes private/protected methods readable for backward compatibility.
 226  	 *

PHP Documentation

<?php
/**
		 * Filters whether XML-RPC methods requiring authentication are enabled.
		 *
		 * Contrary to the way it's named, this filter does not control whether XML-RPC is *fully*
		 * enabled, rather, it only controls whether XML-RPC methods requiring authentication -
		 * such as for publishing purposes - are enabled.
		 *
		 * Further, the filter does not control whether pingbacks or other custom endpoints that don't
		 * require authentication are enabled. This behavior is expected, and due to how parity was matched
		 * with the `enable_xmlrpc` UI option the filter replaced when it was introduced in 3.5.
		 *
		 * To disable XML-RPC methods that require authentication, use:
		 *
		 *     add_filter( 'xmlrpc_enabled', '__return_false' );
		 *
		 * For more granular control over all XML-RPC methods and requests, see the {@see 'xmlrpc_methods'}
		 * and {@see 'xmlrpc_element_limit'} hooks.
		 *
		 * @since 3.5.0
		 *
		 * @param bool $is_enabled Whether XML-RPC is enabled. Default true.
		 */
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.