mercredi 8 juin 2016

WooCommerce Memberships: Conditional to check a page access

I have a Wordpress Memberships website that is built on WooCommerce with WooCommerce Memberships plugin to restrict certain pages to members only.

Some of those pages are "drip-fed"... ie. Access to those pages opens 3 days after purchase, etc. I have set this up in WooMemberships.

I am trying to simply do a PHP conditional check to see if the current user has access to a certain page.

I have found this code piece in the docs: wc_memberships_is_post_content_restricted()

However, I have been unable to make it work.

Is there a code snippet which will basically do a PHP IF statement on whether the current user has access to a certain page (using page ID)?

eg:

if ( current_user_has_access(page_ID) ) { DO SOMETHING } else { DON'T }

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire