get_current_user_id() returns 0?

Going by wp_get_current_user() information in the Codex, the function utilizes the global $current_user object and if necessary initializes it before use. As others have stated, get_current_user_id() uses this function on the backend. Consider /wp-includes/user.php, lines 323-327 (the function definition for this code). At the tail end, the return value is return ( isset( $user->ID ) … Read more

How to Merge Two Authors Into One?

Yes, this is a good question and the answer is basic WordPress 101 (core), contrary to the two comments above. No plugin necessary. You simply go to Users and delete the author (user) that you don’t want to keep. WordPress then asks you if you want to delete their content or attribute it to another … Read more

Confirmation required on email change

Like SickHippie posted this functionality is native to WordPress but only for a multisite setup so here is the two functions you need to get this to work on a single site setup which are mostly code one for one from the core /wp-admin/user-edit.php file function custom_send_confirmation_on_profile_email() { global $errors, $wpdb; $current_user = wp_get_current_user(); if … Read more

Update post counts (published, draft, unattached) in admin interface

I got this almost working, but refinements are needed to fit the specifics of the question and to deal with Attachments and Post-Types differently (see comments in code)… First, I think it’s worth noting how I found the filter: apply_filters( ‘views_’ . $screen->id, $views ) inspect element do a global search in /wp-admin and /wp-includes … Read more