• Resolved Reppiks

    (@reppiks)


    I would like to remove the protection for my RSS feed page and category pages. My site is setup to were my post are not protected, just certain pages. So if you have a way to unprotect all category pages that would be helpful. I personally don’t need to protect/unprotect on a per category basis.

    I see that there are post already addressing these topics from over a year ago, any chance you got to look into solutions?

    https://wordpress.org/plugins/wp-zombaio/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Reppiks

    (@reppiks)

    I have found a solution to this problem!
    To get the RSS feed and category pages, or anything else for that matter, to display without being redirected do the following.

    I added the following code in the wp_zombaio.php starting around line 1284 file right before:

    else {
        $redirect = true;
    }

    I added these few lines

    else if (is_feed() || is_category()) {
        if (get_the_ID() != $target) {
            $redirect = false;
        }
    }

    You should be able to add any conditional tags you may need to allow that page to show without being redirected. If you need only certain categories to be not directed you can follow how to use the conditional tags here: https://codex.wordpress.org/Conditional_Tags

    Now that whole area of code looks like this:

                // valid target?
                if ($target) {
                    // dev hook is page excluded?
                    if (is_home() && !$this->options->redirect_home_page) {
                        $target = false;
                    } else if (is_singular() || is_single() || is_page()) {
                        $meta = get_post_meta(get_the_ID(), 'wp_zombaio_redirect_disable', true);
                        if ($meta == '1') {
                            $target = false;
                        }
                    }
    
                    if ($target) {
                        if ($target === true) {
                            $redirect = true;
                        } else if (is_singular() || is_single() || is_page()) {
                            if (get_the_ID() != $target) {
                                $redirect = true;
                            }
                        }
                        
                        else if (is_feed() || is_category()) {
                            if (get_the_ID() != $target) {
                                $redirect = false;
                            }
                        }
                        
                         else {
                            $redirect = true;
                        }
    
                        if ($redirect) {
                            header('Location: ' . $target_url);
                            exit;
                        }
                    }
                }
    Thread Starter Reppiks

    (@reppiks)

    Depending on how your setting up your site you can also do a quick and dirty method by changing the last part of that code from:

    else {
        $redirect = true;
    }

    to:

    else {
        $redirect = false;
    }

    This will allow access to all those other pages that aren’t the main page, posts, and pages you create. This will give access to 404, archive pages, categories, and whatever else WP creates.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Any planned updates for RSS feed and category pages?’ is closed to new replies.