Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dparker1005/628b70478eb279a5c0af15debf810327 to your computer and use it in GitHub Desktop.
Save dparker1005/628b70478eb279a5c0af15debf810327 to your computer and use it in GitHub Desktop.
Do not update user's first and last name while on the PMPro Checkout page. Useful if you do not want the user's billing name to be the name on the account.
<?php
// Copy from below here.
/**
* Do not update user's first and last name while on the PMPro Checkout page.
* Useful if you do not want the user's billing name to be the name on the account.
*/
function my_pmpro_prevent_name_save_at_checkout( $check, $object_id, $meta_key ) {
if ( $meta_key === 'first_name' || $meta_key === 'last_name' ) {
if ( function_exists( 'pmpro_is_checkout' ) && pmpro_is_checkout() ) {
return false; // Do not update user meta.
}
}
return $check;
}
add_filter( 'update_user_metadata', 'my_pmpro_prevent_name_save_at_checkout', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment