How to allow WordPress updates to only one specific administrator?

SOLUTION: We take this code and paste it to functions.php : function createit_hide_upd_for_other_adm_users() { $current_user = wp_get_current_user(); if ( 777 != $current_user->ID ) { //change the user ID add_filter( ‘pre_site_transient_update_core’, ‘disable_updates’ ); add_filter( ‘pre_site_transient_update_plugins’, ‘disable_updates’ ); add_filter( ‘pre_site_transient_update_themes’, ‘disable_updates’ ); } else { } } add_action( ‘init’, ‘createit_hide_upd_for_other_adm_users’ ); You just need to find the … Read more

Send clear password via mail

user_register isn’t the solution for your needs because when this action is trigger, the password is already encrypted. The best solution is to do a custom registration form and insert your new users with this hook: wp_insert_user() When a user is register, you can send a custom email with the password not encrypted.

Add User Role: Pre-saved in User-Meta [SOLVED]

That’s because you’re not passing an actual ID to get_user_meta, but merely a string of id: $get_portal_number = get_user_meta(‘id’, ‘portal_number’, false); In addition, the third parameter is set to false, which will return an array. You’re passing that value straight to $user->add_role, but that expects a string. You either have to loop over your post … Read more

Foreach loop inside an array_merge

Someting like this? foreach ($subscribers as $user) { $users[] = array( ‘label’ => $user->display_name, ‘value’ => $user->display_name ); } Then do the array_merge with $users

Some weird users in database

Might be this is due to the Spam. Diable use registration under the General -> Settings if you don’t need registration on the front-end or use the captcha or other spam protection plugins. Regarding the backend -> Have you checked the wp_usermeta table if any role assigned to those users or not? Check user roles … Read more