According to http://v2.wp-api.org/reference/posts/ you have categories_exclude available as a param to pass to the API.
This should work:
http://localhost/wp-json/wp/v2/events/?categories=23&categories_exclude=42&per_page=1
…to get the posts from category 23, but exclude those that also have 42 assigned as category.
Related Posts:
- Exclude Category filter from Portfolio section
- Include posts from some categories while excluding from others
- Exclude post ID from wp_query
- How to query only for products with status “in stock” in WooCommerce? [closed]
- get_posts with multiple categories
- ajax category filter
- WP Rest API v2 return posts with specific tag
- How to order category.php loop by ‘meta_value’?
- How can I display recent posts from a particular category in my header?
- Sorting Posts by custom field
- Get attached media only
- WP Query with multiple categories – passing an array works?
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- WP_query category__in not working, only pulls from first category
- How get posts from a subcategory of a category by name?
- Order WP Query posts by custom order calculated from post meta values
- Get image of latest post from taxonomies/categories
- How To Remove/hide some specific categories from two different categories widget from sidebar
- WP Rest API max limit include parameter?
- WP_Query arguments to fetch custom post type posts which are in certain category?
- How do I reset this wp_list_categories query?
- How to get count of posts assigned to given category?
- WP_Query Excluding pages with Order is 0
- How to show subcategories using loop?
- WP_Query To call data from diffrent tables
- Remove a specific category ID from related post
- Complex Category selection as per user input
- Show all post for a given category
- Five posts from a category in footer
- Return only post(s) which have post_excerpt
- How to get all unique categories for posts in loop?
- How can I create ‘future’ and ‘past’ parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?
- Display Featured Post by Categories and Avoid duplicated posts
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- category query for pages not working
- How does one perform a sub query with different post types
- Query posts intersecting tags and categories
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- Loop Performance > JSON files vs. WP_Query vs. REST API
- REST API: Limit Read Permissions for Default Endpoints
- Excluding pages in WP_query using ACF
- Check if loop has any categories?
- Avoid repeated post on page 2 when excluding one on page 1
- Inserting HTML to close and open divs in WP_Query loops
- Finding WordPress Posts assigned to multiple categories
- Exclude current post from an array of posts?
- Combine results of multiple WP_Query to resemble single WP_Query
- Loop doesn’t exclude the specified category in home page
- Exclude recently updated post from custom WP_Query using multiple loops
- WordPress Custom Search Form Displaying Unexpected Results
- Get user first name from custom endpoint
- JSON – Create rest api endpoint for Advanced Custom Fields
- Query_vars support in Rest API
- wp_query is showing posts from other categories
- Hide products in uncategorized category from search results
- How to display a list of posts in same child category as current post
- Slider won’t work with custom query
- WP_Query with one category in args shows other categories
- How to exclude a category name from showing?
- Loop categories by recent post
- How order posts from category by date and comment count?
- How to get posts by category and by choosing a taxonomy term?
- Getting the permalink to the latest post from a category
- What is wrong with my WP_Query Arguments?
- I need to exclude from a query a category and a few custom taxonomies
- specific post is not excluded from the loop
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- get_the_terms has strange result since version 6.0
- How can I return only IDs from the `posts` REST endpoint?
- Related posts by current posts child category
- WP_Query retuning empty array in rest api
- Filter sub-category from checkbox form
- Filter products on category AND tag
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- How to use the Term Object from a custom select field in a query
- wc_get_products() return empty object
- How can I filter products by meta in Woocommerce REST API?
- Related categories order posts by category
- Display All Top Child Categories / Taxonomy
- Query post by Category and custom file (ACF)
- getting posts by tags
- Display 3 levels of categories on page
- Filtering ‘Featured’ posts from a batch of category IDs
- Show posts from categories instead of tags
- Help displaying related categories
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Show full category tree for a year with all post titles?
- Retrieving category pages from subcategory returns empty sets
- query.php – multiple is_category functions
- Create multiple sections for all categories and then queries all the posts for each of those categories
- query_posts problem – need help
- Related posts with WP_Query
- Filter posts by category
- query_vars category_name only display one catgory out of multiple categories
- How to replecate the _fields parameter in custom REST api endpoint
- How to retrieve _embed (etc) fields in get_posts custom query?
- I need to get all categories from a WP_Query
- Custom Taxonomy in custom REST API search
- Pagination only showed when no category is set in wp_query
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2