I'm trying to use the REST API v2 to populate a modal window when clicking on a project custom post type item.
Projects have a custom taxonomy, Skills. I'm using ?_embed on the JSON URL and it is returning the custom taxonomy items, but it's being limited to 10 terms for each returned Project item. I can't seem to do anything to get ALL of the tagged Skills to return for a given Project item.
I updated the general pagination settings in the WordPress settings to be 20, thinking that would adjust the number of associated taxonomy terms returned: no change.
I added the following method to make the taxonomy accessible via REST:
add_action( 'init', 'my_custom_taxonomy_rest_support', 25 );
function my_custom_taxonomy_rest_support() {
global $wp_taxonomies;
$taxonomy_name = 'skill';
if ( isset( $wp_taxonomies[ $taxonomy_name ] ) ) {
$wp_taxonomies[ $taxonomy_name ]->show_in_rest = true;
$wp_taxonomies[ $taxonomy_name ]->posts_per_page = -1;
}
}
And I've tried all variations of per_page, posts_per_page and using -1, 0, 99 to no avail. I can't seem to find anything about this being an issue for anyone else so I'm at a bit of a loss of what to do here. If a project is tagged with 14 skills, the most I can ever get back from the REST API is 10 Skill taxonomy terms for each Project.
Anyone know how to change the limit to be unlimited?
"nopaging" => 1
in the requesthide_empty
argument wich can filter results : developer.wordpress.org/reference/classes/wp_term_query/…