Make custom post type archive for administrator only

Question

Simply I have made a custom post type named ticket and have created an archive-ticket.php file I want to make if the user that tries to visit the tickets archive page is not administrator redirect him/her to the home page.

I can make a simple solution like add something like this code in the file direct:

wp_redirect( home_url( '/' ) );
exit();

Buy i feel that this is not a profestional solution and feel that this is bad for seo.

0
, , , John 4 years 2020-02-25T08:38:38-05:00 0 Answers 62 views 0

Leave an answer

Browse
Browse