WP REST API – Limit the taxonomy search to the first letter
You can use the rest_names_query filter to handle the custom starts_with REST API parameter, and use the terms_clauses filter to add a custom SQL clause for searching terms having their name starting with the specified letter (e.g. A or a for /wp/v2/names/?starts_with=A): add_filter( ‘rest_names_query’, function( $args, $request ){ if ( ‘/wp/v2/names’ === $request->get_route() && // … Read more