Created
February 9, 2022 21:31
-
-
Save ideadude/31b6e92083996608bc5c4bcec4c62502 to your computer and use it in GitHub Desktop.
Debug PMPro's pmpro_membership_content_filter() function.
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 | |
/** | |
* We can use the pmpro_membership_content_filter filter in | |
* the pmpro_membership_content_filter() function to debug | |
* and see what the $content and $hasaccess vars are set to | |
* at the time of running. | |
* | |
* IMPORTANT: This code will effectively break your site with | |
* the debug info. Only use this for a moment, then deactivate it. | |
* | |
* Add this code to a custom plugin or code snippet: | |
* https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/ | |
*/ | |
function my_pmpro_membership_content_filter_debug( $filter, $content, $hasaccess ) { | |
echo "<hr />"; | |
var_dump( $content ); | |
echo "<hr />"; | |
var_dump( $hasaccess ); | |
return $filter; | |
} | |
add_filter( 'pmpro_membership_content_filter', 'my_pmpro_membership_content_filter_debug', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment