Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#62671 new defect (bug)

REST API Plugins Endpoint: Plugins are activated before language packages are installed

Reported by: orballo's profile orballo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.7
Component: REST API Keywords: has-patch
Focuses: rest-api Cc:

Description

Problem

When using the REST API endpoint to install a plugin and activate it, the plugin is activated before the plugin's languages are installed. This causes that if the plugin is creating some content during activation (i.e., WooCommerce creates a series of pages), this content is created in English instead of following the language setting from WordPress.

Expected behavior

When installing and activating a plugin via REST API, the content created by the plugin (i.e. WooCommerce) should be created in the same language as WordPress.

Request example

POST /wp/v2/plugins
{
  "slug": "woocommerce",
  "status": "active"
}

Related code

https://github.com/WordPress/wordpress-develop/blob/b6f639737c5fa722dd5a80f0ad94e48c67c37ffd/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php#L364-L402

Possible solution

Invert the order of the operations in the highlighted code so languages are installed first and the plugin is activated after.

Change History (1)

Note: See TracTickets for help on using tickets.