Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Last active November 30, 2020 00:26
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 kimcoleman/d4eb648be9a5f5695a69362ffedfb386 to your computer and use it in GitHub Desktop.
Save kimcoleman/d4eb648be9a5f5695a69362ffedfb386 to your computer and use it in GitHub Desktop.
Remove the welcome message from the WooCommerce My Account page.
<?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' );
@1101blueli
Copy link

It doesn't work. and it broke the site
Fatal error: Uncaught Error: Call to undefined function pmpro_getMembershipLevelForUser() i

@kimcoleman
Copy link
Author

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