WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#50880 new enhancement

Allow wpmu_create_user to return a WP_Error

Reported by: johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Users Keywords: good-first-bug has-patch
Focuses: multisite Cc:

Description

The wpmu_create_user() function calls wp_create_user() which returns a descriptive WP_Error object upon failure, but this error isn't passed on as the return value from wpmu_create_user() which instead returns boolean false.

A $wp_error parameter should be added to wpmu_create_user() (similar to wp_insert_post()) in order to instruct the function to return the WP_Error object when there's a failure.

This will allow, for example, WP-CLI to show a more descriptive error message when there is a failure when attempting to create a user on Multisite. Currently it has to show a generic Unknown error creating new user message.

#21910 is related, but hasn't seen any movement in years, so for now let's add this parameter.

Change History (1)

This ticket was mentioned in PR #463 on WordPress/wordpress-develop by mikeyhoward1977.


5 weeks ago

  • Keywords has-patch added; needs-patch removed

Return WP_Error object on failure from wpmu_create_user()

Trac ticket: https://core.trac.wordpress.org/ticket/50880

Note: See TracTickets for help on using tickets.