Specification on using URL group to restrict access to custom post types

Hello everyone!

I am not sure how to use the URL group feature mainly because there's a section concerning "regular expressions".

I have no idea how to use regular expressions even after visiting the link provided in the manual.

What I would like to do is protect access to certain custom post types to visitors. So I don't want them to be able to view nor create those custom post type posts.

Should I simply add: http://mydomain.com/custom-post-type in the page URL field or do I have to add a regular expression to that?

Thank you very much for your help,

Sabine.

  • Vaughan

    hi @dansmonpetitstudio

    thanks for posting.

    regex can be complicated, or it can be simple. it just depends on how complex you want the rules to be.

    however, goto 1 of the pages where your custom post type is & copy the url from there. that should work as you suggest. depending on how your site works, this solution might be fine for you without requiring regex to be used.

    if you have 50 or 100 different urls though, it could get a bit daunting creating 100 URL rules. but if you still want to provide access to those page but restrict all those pages such as create.

    http://domain.com/events/create or events/add

    then you have another plugin with say reservations/create or reservations/add

    it would be quicker to use a regex pattern to just check on the last part of the url such as does it end in create or add. and so on.

    hope this helps

    thanks.

  • dansmonpetitstudio

    Hello @Vaughan

    Thank you for your reply... but I'm affraid I do not understand everything your wrote. For example, this:

    but if you still want to provide access to those page but restrict all those pages such as create.

    This sentence sounds like a contradicition to me..

    And then you write:

    http://domain.com/events/create or events/add

    then you have another plugin with say reservations/create or reservations/add

    I don't understand why you are writting about a plugin... Could you maybe explain a bit more what you really mean?

    What I think I understand is that if I want to create a URL group that restrict access to every post for a specific custom post type, I would need to add each post URL one by one. Is that so?

    What if I want this to be done automatically? That's when I would need to add some regular expression codes, right?

    Do you know what regular expression code I would need to add to my URL to simply restrict all the custom post type posts to visitors?

    Thank you very much for your input,

    Sabine.

  • Jack Kitterhing

    Hi there Sabine,

    I hope you are well today and sorry about the extreme delay with a reply on this.

    I'm afraid there isn't a regular expression for limiting all custom post types, it would most likely be easier to avoid regular expressions as you have multiple custom post types, that way you can just add a URL group for the URL you want to protect.

    Say you wanted to protect a custom post type called "product" you could then just add a group called http://yourdomain.com/prodcut and that should protect them.

    Or if you did want to use regular expressions, use http:disappointed:yourdomain.com/product/* And set regular expression to Yes.

    If you need any further assistance I'm here to help.

    Thank you!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.