Created
December 2, 2022 09:48
-
-
Save ipokkel/cf5c0776ebbe8c706fc4290bde638fe4 to your computer and use it in GitHub Desktop.
Hide and remove the "Cancel All Memberships" link from the PMPro Cancel page.
This file contains 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 | |
/** | |
* Hide and remove the Cancel All Memberships link from the PMPro Cancel page. | |
* | |
* 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 css_hide_cancel_all_memberships() { | |
global $pmpro_pages; | |
// are we on the cancel page? | |
if ( is_page( $pmpro_pages['cancel'] ) ) { | |
?> | |
<style> | |
#pmpro_cancel .pmpro_actions_nav { | |
display: none; | |
} | |
</style> | |
<?php | |
} | |
} | |
add_action( 'wp_head', 'css_hide_cancel_all_memberships' ); | |
function js_hide_cancel_all_memberships() { | |
global $pmpro_pages; | |
// are we on the cancel page? | |
if ( is_page( $pmpro_pages['cancel'] ) ) { | |
?> | |
<script> | |
jQuery( document ).ready( function() { | |
jQuery( '#pmpro_cancel .pmpro_actions_nav' ).remove(); | |
} ); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'js_hide_cancel_all_memberships' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment