Title: Exclude categories in WP REST API response through function
Last modified: August 31, 2019

---

# Exclude categories in WP REST API response through function

 *  [diplatis](https://wordpress.org/support/users/diplatis/)
 * (@diplatis)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-categories-in-wp-rest-api-response-through-function/)
 * I want to exclude some categories from the API response but not using the argument
   exclude but through function:
    When using the default route: [https://example.com/wp-json/wp/v2/categories](https://example.com/wp-json/wp/v2/categories)
   I want to return the results for: [https://example.com/wp-json/wp/v2/categories?exclude=26995,41088](https://example.com/wp-json/wp/v2/categories?exclude=26995,41088)

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-categories-in-wp-rest-api-response-through-function/#post-11887177)
 * You can use the “[rest_category_query](https://developer.wordpress.org/reference/hooks/rest_this-taxonomy_query/)”
   to add or alter query args that would have normally been appended to the API 
   request.

Viewing 1 replies (of 1 total)

The topic ‘Exclude categories in WP REST API response through function’ is closed
to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-categories-in-wp-rest-api-response-through-function/#post-11887177)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
