16

Protecting An Entire WordPress Category

You can protect an entire WordPress “Category” in your WP blog, simply by adding the “Permalink” of that category to a “Product”, just like you would protect the permalink of a blog post or page.

Please note that on the DAP Product page, you will only see the permalinks to Pages and Posts, not Categories. So the category permalink is something you would have to figure out (it’s very easy) as shown below, and then directly add that permalink to the DAP Product.

Figuring Out The Category Permalink

So, browse to your blog in your browser, visit the category that you wish to protect on your blog.

If your blog is in the root, it will look like….

http://www.digitalaccesspass.com/category/my-category-name/

If your blog is in a sub-folder called, say, “blog”, then the link will look like…

http://www.digitalaccesspass.com/blog/category/my-category-name/

So copy the link that you see in your browser (this is the “permalink” for that category), log in as DAP Admin, and add it to one of your products. That’s it.

Just protecting the category will protect all posts assigned to that category, be it posts that were already assigned to it, or posts that you will be creating in the future and assigning to that category.

IMPORTANT

When you add an entire category of posts to DAP, then all posts in that category – posts currently in that category, as well posts you will be adding in the future under that category – will all become automatically protected.

So if you add the entire category to DAP and then configure that “link” to be available on a certain day, or date, then remember that ALL posts within that category will automatically become available on that day or date.

WARNING 1

Also remember that because you are adding an entire category of posts, and not individual posts, you won’t be able to configure individual posts within that category to be dripped at various times. Only the “category” link can be configured to be dripped, and not the individual posts within it.

ALTERNATIVE

Please note that when you protect a category in DAP, then all posts that are assigned to this category will drip at the same time. It’s not possible to drip the category itself on “Day #X” and then drip the posts within on different days. It’s ALL OR NOTHING when it comes to category protection.

So if you want a much more tighter control on the dripping, then better to use Pages and Sub-Pages in WordPress.

Since you would anyway need to set up a dripping “day” for each piece of content, it is actually highly recommended that you drip them as Pages and not posts.

So let’s say you create 3 pages:

http://yoursite.com/Month-01
http://yoursite.com/Month-02
http://yoursite.com/Month-03

Then there would be sub-pages (Pages which have above Pages as the Parent) under each of these, like…

http://yoursite.com/Month-01/Week-01
http://yoursite.com/Month-01/Week-02
http://yoursite.com/Month-01/Week-03

Etc.
So then you can drip a Page on Day #1 (say), and then drip the sub-pages on Day #2, #3, etc.

That’s the easiest, best and most convenient set up, especially if you want a great deal of control over the dripping, and also don’t want anyone to see even any links or hints regarding what else is coming.

IMPORTANT

If you do category protection, then you MUST use a custom error page. So basically, create a custom error page – like http://YourSite.com/error/ – and then use that as the “Error Page URL” of the product under which you’ve protected the category, and also the Error-Page URL (Global) under setup config.

Troubleshooting

If you protect a category, and you can still access all of the posts assigned to that category, then it could mean…

1) You are already logged in as a user who does have authorized access to the product under which the category is protected. Or,

2) It means you have turned on “Sneak-Peek” but haven’t inserted any more tags into your posts, so the entire posts are showing up unrestricted. In which case, you will either need to turn off Sneak-Peek, or keep sneak-peek on and insert more tags into all of your posts.

Click Here to Leave a Comment Below 16 comments
Lisa - June 5, 2009

Hi Ravi, I was a customer of WMIAB way back and can attest to your expertise. I’m SO HAPPY to see you have a WordPress Membership site plugin, there is a great need for a solid one.

Anyhow, does this apply to subcategories also? So if I have a category named “tutorials” and then three subcats under it (ie: “subcat1” “subcat2” and “subcat3”) can I…

Have them have access to subcat1 on day one, then add subcat2 on day 7, and then subcat3 on day 14?

Hope that makes sense!

Reply
Ravi Jayagopal - June 5, 2009

Lisa,

Good to hear from you!

Yes, you can protect sub-categories. But remember, if you protect an entire category, you can’t publicly publish your archives, because if someone who is not entitled to a category clicks on the link, they will get an empty blog page with errors.

So as long as you don’t publish the archives or category listing on your site, you can do that.

A better way is to protect individual posts, and make X posts (from one category) all available on the same day. That will have the same effect as far as your member is concerned, and you won’t have to worry about hiding any of the categories. This will work as normal.

Feel free to email me if you have more questions.

– Ravi

Reply
Mark - November 15, 2009

I’m guessing that the MORE tag function will still work as usual within each post in a protected category?

Reply
Ravi Jayagopal - November 16, 2009

Mark,

Yes, that is correct. No changes to the “More” tag.

– Ravi

Reply
GA - July 24, 2010

Hi Ravi,

Should this work with a section of posts that are grouped by a tag?

Such as:
http://yoursite.com/tag/example/

Best,
GA

Reply
Geoff - November 2, 2010

Ravi,
Is there a way in WP 3 custom menus to have them show / hide based on access rights just like the primary menu?

BTW Loving the product.

Reply
Ravi Jayagopal - November 3, 2010

Geoff,

No, DAP doesn’t automatically hide protected pages from WP custom menus. That happens only in regular menus.

We will try to work it into a future version.

– Ravi

Reply
Sarah - September 3, 2012

I’ve put in a catagory in a product, but now when I go to edit any page within that product I get redirected to a completely different page. Can you tell me how to fix this?

Reply
Victoria Bampton - December 3, 2014

Does this only work for categories, or can it work for any URL? For example, I have custom post type ‘Premium’ – can I protect http://yoursite.com/premium/ and all of the pages inside will be automatically protected? Or do I need to add those pages (http://yoursite.com/premium/page1, http://yoursite.com/premium/page2, http://yoursite.com/premium/page3) one at a time?

Reply
Ravi Jayagopal - December 6, 2014

Hi Victoria,

If you protect a category, then all posts assigned to it will automatically get protected.

However, if you protect a custom post type, then only the permalink of that custom post type will be protected.

>>do I need to add those pages (http://yoursite.com/premium/page1, http://yoursite.com/premium/page2, http://yoursite.com/premium/page3) one at a time?<< Correct. You need to add the child pages separately if it's not a category. - Ravi Jayagopal

Reply
Victoria Bampton - December 6, 2014

Good to know, thank you. That might influence how I set up the pages, since I haven’t set them up yet.

Reply
Victoria Bampton - December 6, 2014

Just testing this, as long as I assign a category to the custom post type pages, and protect the category, everything appears to be protected even if I reach it via the custom post type url. Did I get that right or is something cached?

Reply
Veena Prashanth - December 6, 2014

Yes, that’s right.

You can access the content in a different browser where you are not logged-in and see if it is protected (just to be sure).

Thanks,
Veena

Reply
Victoria - December 7, 2014

That looks like it’ll work perfectly. I can organize by custom post type on the back end, but protect using a category.

Only thing that doesn’t seem to be working is when I protect by category, it can’t figure out which product it is on the ‘not logged in’ page and reverts to using the global sales page. I tried it with a normal post protected by a different category, but got the same result – is that expected? It’s not the end of the world but would be useful.

Reply
Ravi Jayagopal - December 7, 2014

>>when I protect by category, it can’t figure out which product it is on the ‘not logged in’ page and reverts to using the global sales page<< Correct. That's expected, because the performance cost of figuring out the post, custom post type, category etc would unnecessarily slow things down. So if you're doing category protection, then try using a custom error page, instead of the default DAP error message. That way, the redirection will work to whatever error page you designate, rather than try and figure out which post, which category, etc. - Ravi Jayagopal

Reply

Leave a Reply: