Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/6c4e42b809f557c8d81fe435a91a5377 to your computer and use it in GitHub Desktop.
Save kimwhite/6c4e42b809f557c8d81fe435a91a5377 to your computer and use it in GitHub Desktop.
Example of a custom PMPro no access message body with a button link.
<?php
/**
* Customize the no access message with a button.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_no_access_message_body_with_button( $body, $level_ids ) {
global $pmpro_pages;
$body = '<p><strong>You must be a Member member to access this content.</strong></p><p><a href="' . pmpro_url( 'levels' ) . '" class="pmpro_btn">Join Now</a></p>';
return $body;
}
add_filter( 'pmpro_no_access_message_body', 'my_pmpro_no_access_message_body_with_button', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment