Redirect away from page if user is not admin

Question

I have a WordPress page that should only be visible to the admin. Any other kind of user role, or logged-out visitors, should be redirected away to the home page if they ever try to visit that page.

Most snippets I found are good for redirecting after logging in or even redirect based on user role. Since I do not have registration on my website, there are no roles basically, just visitors and admin.

Any idea or where to look?

0
, , Paolo Montalto 5 months 0 Answers 63 views 0

Leave an answer