0

I am trying to "hide" one specific category and all posts on that category by redirecting all links to the homepage.

Currently i am using the below on .htaccess

Redirect 301 "/coming-soon/" "https://www.website.gr"
Redirect 301 "/category/coming-soon/" "https://www.website.gr"
RedirectMatch 301 ^/coming-soon/.*$ "https://www.website.gr"

This partially works with an exception Admins/Editors can't view these pages or preview these posts.

Is there any way i can have these redirect rules to not apply on Admin/Editor users?

1 Answer 1

0

Uh Oh. You are using absolutely useless method. Posts, categories(and everything in WP) can be freely accessed via different kind of url combinations,feeds,api and etc (so forget your code/htaccess method).

Instead, use php codes in your active theme's functions.php:

if (is_category() )
{
    global $cat;
    if ($cat->term_id = 123) 
    {
        if (!current_user_can('install_plugins'))
        {

        }
    }

}

replace category id with desired one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.