Support » Plugin: Paid Memberships Pro » Exclude a post from restriction

  • Resolved Pexle Chris


    Hi. And many thanks for your awesome plugin!

    If I want to exclude a post from being restricted, how can I do it?

    Is there any hook that alters the WP_Query ?
    To unhook it and alter the functionality, so with a custom field to add an exclusion on the restriction…

    Any help? 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Andrew Lima


    Hi @pexlechris

    Thank you for using Paid Memberships Pro, I’m glad to hear you’re enjoying our plugin.

    If you want to exclude a post from being restricted, you may assign it a non-restricted category or do not select any membership levels in the “Require Memberships” metabox.

    Would this be sufficient, or would you like to do it programmatically?

    Thread Starter Pexle Chris


    This would be sufficient but does not work…

    I have a post that belongs to a restricted category and also in a non-restricted category.
    This post is restricted.

    In the metabox none choice is checked but in the bottom says
    “* This post is already protected for this level because it is within a category that requires membership.”
    Does not make sense.

    If there is no other way, I can do it programmatically…

    Plugin Author Andrew Lima


    You would need this post to belong to only categories that don’t require a membership. If a post has a category that requires membership, this takes priority and a level will be required to view the post.

    A solution may be to create a new category called “free” for example, and assign this category (only) to all posts that shouldn’t require a membership level.

    Selecting the categories inside each membership level setting restricts that category to that membership level (and can be a combination thereof). You may also unselect categories inside each levels settings to remove these restrictions.

    If the category isn’t selected in any of the membership levels, this makes the category ‘public’ to anyone.

    I hope this helps clear things up.

    Thread Starter Pexle Chris


    ok I have understand how it works.

    But I want this post to belongs to a restricted and non restricted category. 🙂

    Is there a way to do it with a hook? I know wordpress and php so I can do it myself if you tell me which hook I have to use.


    Plugin Author Andrew Lima


    You may bypass membership restriction by using the pmpro_has_membership_access_filter –

    Within this filter, you may return true based on custom conditions such as post ID, post category, user roles etc.

    I hope this helps get you started.

    Thread Starter Pexle Chris


    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude a post from restriction’ is closed to new replies.