Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make All The Existing Profiles Private
<?php
// Make All The Existing Profiles Private
function yzc_make_all_old_accounts_priavte() {
$option_name = 'yzc_is_all_old_profiles_private';
if ( ! get_option( $option_name ) ) {
// Get All users Id's
$users = get_users( array( 'fields' => 'id' ) );
foreach ( $users as $user_id ) {
update_user_meta( $user_id, 'yz_enable_private_account', 'on' );
}
update_option( $option_name, 1 );
}
}
add_action( 'init', 'yzc_make_all_old_accounts_priavte' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment