W3cubDocs

/WordPress

wp_xmlrpc_server::set_is_enabled()

Sets wp_xmlrpc_server::$is_enabled property.

Description

Determines whether the xmlrpc server is enabled on this WordPress install and set the is_enabled property accordingly.

Source

private function set_is_enabled() {
	/*
	 * Respect old get_option() filters left for back-compat when the 'enable_xmlrpc'
	 * option was deprecated in 3.5.0. Use the 'xmlrpc_enabled' hook instead.
	 */
	$is_enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
	if ( false === $is_enabled ) {
		$is_enabled = apply_filters( 'option_enable_xmlrpc', true );
	}

	/**
	 * 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 'xmlrpc_methods'
	 * and 'xmlrpc_element_limit' hooks.
	 *
	 * @since 3.5.0
	 *
	 * @param bool $is_enabled Whether XML-RPC is enabled. Default true.
	 */
	$this->is_enabled = apply_filters( 'xmlrpc_enabled', $is_enabled );
}

Hooks

apply_filters( ‘xmlrpc_enabled’, bool $is_enabled )

Filters whether XML-RPC methods requiring authentication are enabled.

Changelog

Version Description
5.7.3 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/set_is_enabled