[wp-trac] [WordPress Trac] #62671: REST API Plugins Endpoint: Plugins are activated before language packages are installed

WordPress Trac noreply at wordpress.org
Tue Dec 10 03:21:57 UTC 2024


#62671: REST API Plugins Endpoint: Plugins are activated before language packages
are installed
--------------------------+-----------------------------
 Reporter:  orballo       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  6.7
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 **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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62671>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list