-
-
Save bekarice/d2406d4b6950ecbe25c12e379316313e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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