If you want a parameter to be required for a post type’s REST API endpoint you can use the rest_{$this->post_type}_collection_params
filter to filter the $args
of the GET
endpoint:
add_filter(
'rest_car_collection_params',
function( array $query_params ) {
$query_params['visible_to']['required'] = true;
return $query_params;
}
);
Related Posts:
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Saving Taxonomy Terms
- Custom post types filtered by taxonomy using REST API v2
- Filter get_categories() for taxonomy term in WordPress
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Highlight nav menu terms
- Help with issues on “Adding a Taxonomy Filter to Admin List for a Custom Post Type?”
- Want to filter only parent post in admin area
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- How to add custom fields to admin UI and REST API response?
- Wp Rest API request posts from a custom taxonomy
- Custom Taxonomy breaking pages permalinks
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- Custom Taxonomy Invalid in REST API
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Genesis filterable portfolio isotope [closed]
- How can I see a list of my Custom Post Types of the last term I was in?
- Displaying custom taxonomy in the admin list of a custom post type
- Categories of custom taxonomy don’t show any posts
- WordPress sort search results by custom order
- How to filter wp_list_categories output with some custom post type meta query?
- How to Filter custom post type by taxonomy?
- Filter term taxonomy metabox in custom post type
- How can I made custom taxonomies relationship?
- filter custom post in rest api with custom function
- Sort and filter custom post type posts by custom taxonomy
- Filter posts by tax (dropdown) and meta value
- How to see posts in taxonomy endpoint
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Custom Taxonomy Filter Issues
- WordPress REST API V2: “{CUSTOM_POST_TYPE} matches Term ID List and Term ID Taxonomy Query, but should match only one.”
- Custom endpoint filtering post by custom taxonomies
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Store a value in global scope after init hook is fired
- Filter in Custom post type to find the parent post
- Insert custom taxonomy into category query
- filter rest api post by a acf filed
- Creating adminable dynamic filtering on custom post type
- Dropdown switching subcategories portfolio
- Exclude Custom Post Type from shared Custom Taxonomy
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template
- Custom Taxonomy as Dropdown in admin
- Custom Post type in separate database table for syncing
- Creating Photo Gallery System with Custom Post Type
- Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing
- Custom permalinks
- Correct way to use a form to to filter custom posts by taxonomy terms?
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Custom post type category, taxonomy and URL rewrite problem
- Custom Post Type: How to display all of same taxonomy?
- Is there any performance consideration when using Custom Post Types?
- Filter home_url for custom post type
- Querying Term Posts in Loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Permalinks not working for custom taxonomy on custom post type
- Conditional Statement custom post type category
- custom types taxonomy hide_empty
- How to rewrite url for any specific taxonomy?
- Custom post URL 404 error
- How to change the post type a theme shows by default?
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Permalinks For CPT and pages with parent. Advanced WordPress
- Rewrite custom post type with taxonomy
- Show categories of custom post type and not all posts
- how to count the current posts terms
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Using page title as a link to term archive
- Add custom post type taxonomy tag to article class
- Custom Taxonomy dont save in a frontend form for post a custom post
- Should i use custom post type for a custom footer?
- best way to use custom taxonomy, post type and meta in a job system
- Display the link of a custom taxonomy
- Fetching custom post type without knowing post type (REST API)
- Error 404 change permalink term custom term taxonomy
- WP_Query: how to search tags in addition to a custom post type?
- How to display custom post type taxonomy in Contact Form 7 text field
- Custom Post Type & Taxonomies – Rewrite
- get_posts wont produce a list of custom type from a given category [duplicate]
- PHP Warning with Custom Fields
- Don’t share custom taxonomy terms if applied to multiple Custom Post Types
- How to show custom post count in archive page
- Change CPT permalink to use the category
- How to add independent “Tags” to Custom Post Type?
- Shortcode in excerpt
- Show custom taxonomy not in submenu
- Highlight a Post on archive page if it has a new comment?
- Custom Taxonomy is disabled on Edit page
- Get link for feed of specific post type AND taxonomy
- Get single object term for custom taxonomy
- Sorting custom post types by taxonomy (So close)
- Custom posts and custom taxonomies for many products and categories?
- How to retreive terms associated with a custom post type?
- Return Custom Post Type Categories
- Create taxonomy from Custom Post Type
- How do I filter a custom post type loop by a field?
- ACF Relationship: Group posts by parent category term, then child [closed]
- Permalinks for Custom Post Types and Taxonomies