Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31513 closed defect (bug) (fixed)

Wrong description in DocBlock of function wp_insert_user()

Reported by: floriansimeth's profile floriansimeth Owned by: drewapicture's profile DrewAPicture
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: Users Keywords:
Focuses: docs Cc:


Hey WP-Community,

I hope you all doing good.

I've found out that the variable name in the DocBlock of the wp_insert_user() in file /wp-includes/user.php (line 1689) is wrong.

The parameter $date_registered should be renamed to $user_registered. I don't know really why this parameter is called $user_registered as the value gets saved into the database table cell named date_registered.

I've tested that

wp_insert_user( array(
	'date_registered' => '2010-12-05 10:00:01',
	'user_pass'       => 'test',
	'user_login'      => 'testperson',
) );

will not work whereas

wp_insert_user( array(
	'user_registered' => '2010-12-05 10:00:01',
	'user_pass'       => 'test',
	'user_login'      => 'testperson',
) );

will do the trick (writes the date into the database correctly). So user_registered is right (as the documentation suggests).

I know that this is just a small thing. However it's confusing if one constantly takes a look into the core code instead of the documentation.


Attachments (1)

date_registered-to-user_registered.patch (913 bytes) - added by floriansimeth 9 years ago.

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
9 years ago

  • Component changed from General to Posts, Post Types
  • Milestone changed from Awaiting Review to 4.2
  • Owner set to DrewAPicture
  • Status changed from new to reviewing
  • Type changed from enhancement to defect (bug)
  • Version changed from 4.1.1 to 4.1

Hi floriansimeth,

Nice catch! The patch looks good, and we should be able to get this in for 4.2 no problem. Thanks for the patch.

This was introduced in [29116].

#2 @SergeyBiryukov
9 years ago

  • Component changed from Posts, Post Types to Users

#3 @DrewAPicture
9 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 31608:

Correct a typo in the hash notation for wp_insert_user(): The argument name should be $user_registered not $date_registered.

Props floriansimeth.
Fixes #31513.

Note: See TracTickets for help on using tickets.