Time Unrestrict for Membership Content

This website is for a magazine (coming out every 1 to 2 months).

In short what I want to know is how do I restrict access for only 1 taxonomy term.

The site is set up that every edition/issue is a new Tax Term.

Only Premium members should have access to all the content, everyone else can't read past the Read More of the articles (from 2 post types - post & career) of the latest edition, but have full access to older content.

The website is already set-up to be able to give me the latest issue's tax term any time (the Slider as well as my Latest widget uses this information).

I have read the article at https://premium.wpmudev.org/blog/sit-back-and-relax-put-wordpress-post-management-on-auto-pilot/ but it is not exactly what I want to do.

Any help greatly appreciated.

  • aristath

    Hello there @XiliXTech, I hope you're well today!

    I can think of several ways to do this, but not automatically...
    Meaning each month when a new issue is published you will have to change some things in your access levels.
    It can be done via URL groups, menus, taxonomies... and even using custom code.
    It all depends on how the magazine is currently structured, the URL structure that it uses, the menus structure, and many other factors too...
    Do you need this done automatically? If yes, then custom coding is our only option here! If not, then some more detoails about the way your magazine is currently set-up would be helpful.

    Please advise,

  • XiliXTech

    Hi there Ari

    If at all possible it should be automatic, the less things that have to be set on each edition, the better (less that can go wrong).

    The development version of the website is located at http://projects.xilix.co.za/sacf/, when it is done, it will replace http://www.sacareerfocus.co.za/.

    The website's content structure (the part that is important for this thread):
    * There are 2 post types (post and careers, for standard articles and special career articles respectively).
    * Both have their own custom Taxonomy (Categories and Industries, respectively).
    * Both share a custom Taxonomy (Issues).
    * The url structure for Posts is: {category}/{post name}
    * The url structure for Careers is: careers/{post name}

    The theme is completely custom developed by me for this website (no theme framework was used).

    The Issue Taxonomy terms are ordered using the "Custom Taxonomy Order NE" plugin, thus allowing me to query it and retrieve only the first term (which will be the latest).

    What I have since implemented:

    function can_user_view_full_article($subs_arr = array()){
            //This function takes an array of the subscriptions that would allow a user access to the content
    	if(is_single()){//only for single pages
    		$latest = get_latest_issue();//this just get the term object using get_terms()
    		if(has_term( $latest->term_id, 'issue' )){
    			//it is the latest issue
    			foreach($subs_arr as $sub_id){
    				if(current_user_on_subscription( $sub_id )){
    					return true;//user may view the post
    			return false;//the user is not on the right subscription
    		}else{//it is not the latest issue
    			return true;
    	return true;//we only do anything on a single page;

    The only issue I find with this, is that me (the administrator) and the other staff can't read the full content (as we do not have a subscription). Is there a better way (than) to determine if a user may view the content (so that admins and staff can always see everything)?

    Thank you for the help so far.

  • aristath

    Hello again @XiliXTech,
    I'm glad you managed to figure this one out!

    As for the permissions issue:
    Right now, you're using this line:
    if(current_user_on_subscription( $sub_id )){
    You can change it to this:
    if ( current_user_on_subscription( $sub_id ) || current_user_can( 'manage_options' ) ) {
    So this will check if the current user is on the subscription ID, OR if they have the 'manage_options' capability.
    You can use whatever you want instead of the 'manage_options' that I used above from the table here: http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table

    I hope that helps!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.