wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



rest_format_combining_operation_error › WordPress Function

Seit5.6.0
Veraltetn/v
rest_format_combining_operation_error ( $param, $error )
Parameter: (2)
  • (string) $param The parameter name.
    Erforderlich: Ja
  • (array) $error The error details.
    Erforderlich: Ja
Gibt zurück:
  • (WP_Error)
Definiert in:
Codex:

Formats a combining operation error into a WP_Error object.



Quellcode

function rest_format_combining_operation_error( $param, $error ) {
	$position = $error['index'];
	$reason   = $error['error_object']->get_error_message();

	if ( isset( $error['schema']['title'] ) ) {
		$title = $error['schema']['title'];

		return new WP_Error(
			'rest_no_matching_schema',
			/* translators: 1: Parameter, 2: Schema title, 3: Reason. */
			sprintf( __( '%1$s is not a valid %2$s. Reason: %3$s' ), $param, $title, $reason ),
			array( 'position' => $position )
		);
	}

	return new WP_Error(
		'rest_no_matching_schema',
		/* translators: 1: Parameter, 2: Reason. */
		sprintf( __( '%1$s does not match the expected format. Reason: %2$s' ), $param, $reason ),
		array( 'position' => $position )
	);
}