Title: WP_REST_Comments_Controller::normalize_query_param
Published: December 6, 2016
Last modified: May 20, 2026

---

# WP_REST_Comments_Controller::normalize_query_param( string $query_param ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#parameters)󠁿

 `$query_param`stringrequired

Query parameter.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#return)󠁿

 string The normalized query parameter.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#source)󠁿

    ```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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php#L1334)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php#L1334-L1356)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Comments_Controller::get_items()](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/get_items/)`wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php` |

Retrieves a list of comment items.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/normalize_query_param/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_comments_controller%2Fnormalize_query_param%2F)
before being able to contribute a note or feedback.