Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save greathmaster/2646d6f46ee3a74937da380fb6f5256c to your computer and use it in GitHub Desktop.
Save greathmaster/2646d6f46ee3a74937da380fb6f5256c to your computer and use it in GitHub Desktop.
PMPro Lock Membership Levels-lock existing members. Add this to your customizations plugin and refresh the page. Recommend deleting the code snippet after the operation is complete.
/*
PMPro Lock Membership Levels-lock existing members. Add this to your customizations plugin and refresh the page. Recommend deleting the code snippet after the operation is complete.
*/
function bulk_lock_all_members()
{
global $wpdb;
$users = $wpdb->get_results( "SELECT ID FROM $wpdb->users" );
if( $users ) {
foreach ( $users as $user ) {
update_user_meta( $user->ID, 'pmprolml', 1 );
}
}
}
add_action( "init", "bulk_lock_all_members", 10, 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment