Redirect away from page if user is not admin


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?

, , Paolo Montalto 2 years 2020-09-03T08:10:37-05:00 0 Answers 63 views 0

Leave an answer