Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#44495 closed defect (bug) (invalid)

API requires "reassign" while it's optional within WordPress core

Reported by: apermo's profile apermo Owned by:
Milestone: Priority: normal
Severity: minor Version: 4.9.6
Component: REST API Keywords: close
Focuses: Cc:

Description

https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/user.php#L289

The WordPress function wp_delete_user() has an optional value $reassign.

https://developer.wordpress.org/rest-api/reference/users/#delete-a-user

While the same functionality inside the API has a required value $reassign.

This is inconsistent. Is this for a special reason? If so please explain. Or was this simply overlooked while programming.

Change History (4)

#1 follow-up: @TimothyBlynJacobs
7 years ago

  • Keywords close added

Have you tried setting reassign to a falsey value like 0 or 'false'? The API requires you to provide/acknowledge the reassign parameter, but it should not require reassigning.

This is covered with a unit test, WP_Test_REST_Users_Controller::test_delete_item().

#2 in reply to: ↑ 1 @apermo
7 years ago

Replying to TimothyBlynJacobs:

Have you tried setting reassign to a falsey value like 0 or 'false'? The API requires you to provide/acknowledge the reassign parameter, but it should not require reassigning.

No, I haven't tried that.

So is it by design that you need to set the parameter, and the internal API is inconsistent for backwards compatibility reasons? Or why is it inconsistent?

#3 @TimothyBlynJacobs
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Yes, it was intentional. You can look at this ticket #39000.

#4 @netweb
6 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.