Maybe you should re-consider your tag structure, if you must search for sub-strings, to be able to use it. Otherwise you can try e.g.
$terms = get_terms(
[
'taxonomy' => 'post_tag',
'search' => '-en',
]
);
that performs a wildcard (*
) search for *-en*
within the term’s name or term’s slug. Also note the support for name__like
and description__like
input arguments.
If there are large number of tags, then obviously we don’t want to fetch thousands of tags, at once. We could limit that number with the number
input argument and also use the offset
for paging. Hopefully the page number argument will be supported soon. The count
argument only returns the tag count.