wp_xmlrpc_server::escape() WordPress Method

The wp_xmlrpc_server::escape() method is used to escape a string for use in an XML-RPC request. This is used to ensure that the string is properly encoded for transport over the XML-RPC protocol.

wp_xmlrpc_server::escape( string|array $data ) #

Escape string or array of strings for database.


Parameters

$data

(string|array)(Required)Escape single string or array of strings.


Top ↑

Return

(string|void) Returns with string is passed, alters by-reference when array is passed.


Top ↑

Source

File: wp-includes/class-wp-xmlrpc-server.php

	public function escape( &$data ) {
		if ( ! is_array( $data ) ) {
			return wp_slash( $data );
		}

		foreach ( $data as &$v ) {
			if ( is_array( $v ) ) {
				$this->escape( $v );
			} elseif ( ! is_object( $v ) ) {
				$v = wp_slash( $v );
			}
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
1.5.2Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More