Skip to content

Plugins: Show "Activate" after updating an inactive plugin from Add Plugins - #13163

Open
wprashed wants to merge 1 commit into
WordPress:trunkfrom
wprashed:feat/65909-activate-button-after-update
Open

Plugins: Show "Activate" after updating an inactive plugin from Add Plugins#13163
wprashed wants to merge 1 commit into
WordPress:trunkfrom
wprashed:feat/65909-activate-button-after-update

Conversation

@wprashed

Copy link
Copy Markdown

Trac Ticket

https://core.trac.wordpress.org/ticket/65909

Description

When updating an inactive plugin from the Add Plugins screen (Plugins > Add New), the button currently remains as a disabled "Updated!" state. Users must navigate to the Installed Plugins screen to activate it.

This PR brings consistency with the plugin installation flow: after successfully updating an inactive plugin, the button changes to "Activate" (or "Network Activate").

The Changes

  1. wp_ajax_update_plugin() (src/wp-admin/includes/ajax-actions.php):

    • Added activateUrl generation when the updated plugin is inactive and the current user has the activate_plugin capability (matching the logic in wp_ajax_install_plugin()).
  2. wp.updates.updatePluginSuccess (src/js/_enqueues/wp/updates.js):

    • Added a call to wp.updates.checkPluginDependencies() when response.activateUrl is present in the response.
  3. wp.updates.checkPluginDependenciesSuccess & wp.updates.checkPluginDependenciesError (src/js/_enqueues/wp/updates.js):

    • Extended selector matching and class removal to include .update-now alongside .install-now so update buttons seamlessly transform into .activate-now buttons.

How to Test

  1. Ensure an inactive plugin with an available update is installed on the site.
  2. Navigate to Plugins > Add New.
  3. Search for the inactive plugin.
  4. Click Update Now.
  5. After the update completes, observe the button transition from "Updating..." → "Updated!" → "Activate".
  6. Click Activate to verify one-click activation works directly from the card.

Fixes #65909.

…dd Plugins screen.

When updating an inactive plugin from the Add Plugins screen
(Plugins > Add New), the button remained in the disabled "Updated!"
state instead of transitioning to "Activate", requiring users to
navigate to Installed Plugins to activate it.

This updates `wp_ajax_update_plugin()` to return `activateUrl` for
inactive plugins that the current user has permission to activate,
matching `wp_ajax_install_plugin()`.

It also updates `wp.updates.updatePluginSuccess` to check plugin dependencies
and transform the button to an "Activate" link, and updates
`checkPluginDependenciesSuccess` / `checkPluginDependenciesError` to handle
`.update-now` buttons alongside `.install-now`.

Fixes #65909.
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props wprashed.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant