Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php // only copy if needed!
/**
* Filters the recipe to restrict it to non-members.
*
* @param string $recipe recipe content
* @return updated content
*/
function wpurp_woocommerce_memberships( $recipe ) {
if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted() ) {
$recipe = '[wcm_restrict]' . $recipe . '[/wcm_restrict]';
}
return $recipe;
}
add_filter( 'wpurp_output_recipe' , 'wpurp_woocommerce_memberships' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.