Skip to content
Advertisement

Redirect by user role from a specific admin url to another url

This code works fine if I use is_front_page as current page/url, because it gets my homepage and redirects user by role to a specific path, but it doesn’t work if I try to get a specific current url of wp admin dashboard, I tried with get_home_url(path), but it doesn’t work:

JavaScript

Thank you in advance.

Advertisement

Answer

template_redirect hook is for front-side of your website. For admin side you can use different hooks. Such as init, admin_init etc.

f.e.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement