Tell us what you are trying to do?
I am creating a directory for a client. They have a membership site using woocommerce subscriptions. I created a custom post type of their members to manager their listings. I am trying to hide listings for anyone who let's their membership expire. I can't find a way to do it with the query filter nor with the conditional block in the editor inside the loop. I tried wirting a function to check if the author is a actice subscriber but I am not having any luck. It seems to me that this should be possible but I haven't found a solution and I am hoping I might have missed it or that someone else may have come across this already.
Hello. Thank you for contacting the Toolset support.
It seems you should ask this question to WooCommerce subscriptions support as the action needs to be triggered when the subscription is expired and at that time you need to either delete posts belongs to that user or change the post status to draft.
You may try to use the hooks, so when WooCommerce subscription is expired the role will be changed.
- woocommerce_subscriptions_updated_users_role
You can use the above the hook and find all posts the whole author is the user whose subscription is expired currently and change the post status to draft and it will not display on frontend.
You can check with WooCommerce subscription support for more information about hook and ask them how you can update the post status once the subscription is expired for that user.