WordPress Trac: Ticket #61944: Wrong argument type in documentation for hook new_user_email_content

In wp-includes/user.php, the docs for the new_user_email_content hook specify that both arguments are of type string. The second argument, new_user_email is actually an array, containing the new address as well as a hash. It is declared on line 3726 in the same file.

https://core.trac.wordpress.org/browser/tags/6.6/src/wp-includes/user.php#L3774

milestone deleted 28 Aug 2024, 3:20 am

  • milestone Awaiting Review deleted

status changed; resolution set 28 Aug 2024, 2:48 am

  • status changed from new to closed
  • resolution set to invalid

You're right, I completely misread the docblock. Sorry about this. I'll close the ticket. Thank you.

keywords set 28 Aug 2024, 2:46 am

  • keywords reporter-feedback added

Hi there!

The new_user_email_content shows second args array. See https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/user.php#L3761-L3782

/**
 * Filters the text of the email sent when a change of user email address is attempted.
 *
 * The following strings have a special meaning and will get replaced dynamically:
 * - ###USERNAME###  The current user's username.
 * - ###ADMIN_URL### The link to click on to confirm the email change.
 * - ###EMAIL###     The new email.
 * - ###SITENAME###  The name of the site.
 * - ###SITEURL###   The URL to the site.
 *
 * @since MU (3.0.0)
 * @since 4.9.0 This filter is no longer Multisite specific.
 *
 * @param string $email_text     Text in the email.
 * @param array  $new_user_email {
 *     Data relating to the new user email address.
 *
 *     @type string $hash     The secure hash used in the confirmation link URL.
 *     @type string $newemail The proposed new email address.
 * }
 */
$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );

Page processed in 0.262 seconds.

Powered by SimplePie 1.3.1, Build 20121030175403. Run the SimplePie Compatibility Test. SimplePie is © 2004–2024, Ryan Parman and Geoffrey Sneddon, and licensed under the BSD License.