mercredi 8 juin 2016

WooCommerce Conditional Check of Page

I have a Wordpress membership site that is built on WooCommerce & using WooMemberships 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 }

Thank you!

Aucun commentaire:

Enregistrer un commentaire