The filter uses the third parameter as an array that gets passed to get_terms()
, which you’re already using to specify the taxonomy to query. Looking at the get_terms()
documentation, you can see there’s a ‘number’ argument that you can pass to limit the number of terms returned. This is what you want to use.
Your use of the filter now becomes
$terms = apply_filters( 'taxonomy-images-get-terms', '', array(
'taxonomy' => 'technologies',
'term_args' => array(
'number' => 6,
),
) );
When the filter is applied, $terms
should now be limited to a max of 6 terms.
UPDATE:
The plugin is using a deprecated argument for get_terms()
, which pre-4.5 took two parameters: the taxonomy string and an array of options. That options array is defined as $term_args
in the plugin. As long as that’s in there, you’ll need to pass an array with ‘taxonomy’, and ‘term_args[]’ passed separately instead of in the same array as get_terms()
expects them to be after WP 4.5.