Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove State Field from MemberPress Signup Forms
<?php
//Remove the State Field completely
function trim_down_address_fields($options) {
foreach($options->address_fields as $i => $o) {
if($o->field_key == 'mepr-address-state') {
unset($options->address_fields[$i]);
}
}
return $options;
}
add_filter('mepr_fetch_options', 'trim_down_address_fields');
//Add a fake state value to each user
function populate_state_field($event) {
$user = $event->get_data();
update_user_meta($user->ID, 'mepr-address-state', 'fake');
}
add_action('mepr-event-login', 'populate_state_field');
@cartpauj

This comment has been minimized.

Owner

cartpauj commented Oct 3, 2018

The above code can be installed in a plugin like Code Snippets or My Custom Functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment