Combined with 404 – having troubles

Hey,

So I have both your “restrict categories” plugin, and the “404 redirect” plugin. However I am having trouble in using both of these in tandem. I’ve made sure that “Redirect restricted categories, tags and taxonomy terms …” is selected on the settings page, but I’m still not getting much luck. I’ve managed to find the point of issue which is at:


public static function wp() {
global $wp_query;
...
$is_term = $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax;
if ( $is_term ) {
...
}
...
}

It seems that the $is_term never gets set to be true; looking at the “wp_query” at this point, all it seems to know is the page name, which is just the rewritten URL, and there is no information in the wp_query variable, let alone the restricted category I’ve assigned to the post.

Am I missing something, or need to tweak something? I’ve managed to get around the problem for now (as there is only one subscription level, so when logged in you have access, therefore added an “is_logged_in” check when the code checks if they can read the post) however if the code was ever updated, or we wanted different subscription levels this might cause an issue.

Is there a fix that could be applied to better check the page? Or maybe there is a setting I need to enable?

Thanks for your time,

Dan


Comments

3 responses to “Combined with 404 – having troubles”

  1. Hey,

    I don’t know any of the plugins that would actually interfere, but we have a bunch of woocommerce plugins installed which are the only thing that I could think would interfere. I saw that you have updated the plugin since I last posted so I’ll give it a try again and see if it’s working now. If not, I’ll try disabling plugins and seeing if disabling any of them work.

    However I don’t think it is, I think its something to do with why the ‘$wp_query’ things are empty.

    1. Thanks Dan, let me know after you checked please.

  2. Hi Dan,

    Do you have any other plugin installed that could interfere? As this works fine on a ‘standard’ setup, I suppose that something is different in your setup and we’d have to see what it is.

    Cheers

Share