Skip to content

Instantly share code, notes, and snippets.

@ideadude
Created February 9, 2022 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideadude/31b6e92083996608bc5c4bcec4c62502 to your computer and use it in GitHub Desktop.
Save ideadude/31b6e92083996608bc5c4bcec4c62502 to your computer and use it in GitHub Desktop.
Debug PMPro's pmpro_membership_content_filter() function.
<?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