WP_REST_Comments_Controller::normalize_query_param( string $query_param )

Prepends internal property prefix to query parameters to match our response fields.


Parameters Parameters

$query_param

(string) (Required) Query parameter.


Top ↑

Return Return

(string) The normalized query parameter.


Top ↑

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

	protected function normalize_query_param( $query_param ) {
		$prefix = 'comment_';

		switch ( $query_param ) {
			case 'id':
				$normalized = $prefix . 'ID';
				break;
			case 'post':
				$normalized = $prefix . 'post_ID';
				break;
			case 'parent':
				$normalized = $prefix . 'parent';
				break;
			case 'include':
				$normalized = 'comment__in';
				break;
			default:
				$normalized = $prefix . $query_param;
				break;
		}

		return $normalized;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.