Unable to do WP_User_Query with meta filter

This isn’t possible, you can’t safely/reliably query the internals of meta value strings that way, and you can’t use it as a form of indirection:

  • You can query for substrings or for whole values, but you can’t query the internals of serialised PHP values without major performance reliability and consistency issues
  • but if you could, or if it was just the plain number, there’s no way to then take that and plug it into a term query
  • You can only use tax_query to find users in a given taxonomy, but your users don’t have terms, and they aren’t in a taxonomy.

User taxonomies are a thing, so be careful about what you’re asking. Instead, you need to rephrase your question like this:

How do I find users with a specific value that’s listed in the mygroups user meta field using WP_User_Query?

And the answer is, you can’t. This is because mygroups is stored as a serialised PHP array, and you can’t query sub-values of serialised values. E.g. you could use a LIKE style parameter to search for group 1 but it will also give you 10, 100, 41, etc It may even give you users who have a group number that is 1 digit long, and users that have 1 group even if that groups number is 9999.

It may be that there is a solution that uses features of the Ultimate Member plugin, but questions about that plugin and other 3rd party plugins are off-topic here and not in this stacks scope