Last active
November 30, 2020 00:26
-
-
Save kimcoleman/d4eb648be9a5f5695a69362ffedfb386 to your computer and use it in GitHub Desktop.
Remove the welcome message from the WooCommerce My Account page.
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 | |
/** | |
* Remove the welcome message from the WooCommerce My Account page. | |
*/ | |
function remove_woocommerce_account_content() { | |
if ( function_exists( 'pmpro_getMembershipLevelForUser' ) ) { | |
$level = pmpro_getMembershipLevelForUser(); | |
if ( esc_attr( $level->ID ) === '4' ) { | |
remove_action( 'woocommerce_account_content', 'woocommerce_account_content' ); | |
} | |
} | |
} | |
add_filter( 'init', 'remove_woocommerce_account_content' ); |
This recipe requires Paid Memberships Pro (https://www.paidmembershipspro.com). I just updated the recipe to check that the function exists before running but it will not work for a site without PMPro.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't work. and it broke the site
Fatal error: Uncaught Error: Call to undefined function pmpro_getMembershipLevelForUser() i