I am Using Wordpress version 4.9.4 with WooCommerce an WooCommerce Memberships plugin.
How can I get all users for specific membership plan ($memberships)?
Is there a hook or should I use raw query?
On the documentation, it says that plans / memberships are post type, so I tried to query this table:
SELECT jsu.id, jsu.user_email, jsu.display_name, jsp.post_title, jsp.post_type FROM `wp_users` jsu
LEFT JOIN `wp_posts` jsp ON (jsu.id = jsp.post_author)
LEFT JOIN `wp_usermeta` jsum ON (jsu.id = jsum.user_id)
WHERE jsp.post_title IN ($memberships) AND post_type = 'wc_membership_plan'
But I don't get the desired result.