Redirect if a user has not written a post

Question

I’d like to redirect two different types of users depending on their role and only if they haven’t submitted any post on the site (wether they are pending or published doesn’t matter). I am pretty sure I’m supposed to use count_user_posts() but I’m not really sure how to code this :

If a current user role is “A123”, and current user has no post in the “B123” custom type, then redirect to ‘https://wordpress.org

Can anyone help me code this properly?
Thank you.

0
Clonecorp 9 months 0 Answers 89 views 0

Leave an answer