Skip to content

Add multisite (Network Admin) support for the admin page#1344

Open
borislav-angelov wants to merge 1 commit into
WordPress:trunkfrom
servmask:64-multisite-support-admin-page
Open

Add multisite (Network Admin) support for the admin page#1344
borislav-angelov wants to merge 1 commit into
WordPress:trunkfrom
servmask:64-multisite-support-admin-page

Conversation

@borislav-angelov

@borislav-angelov borislav-angelov commented Jun 4, 2026

Copy link
Copy Markdown

Summary

Fixes #64.

The admin screen and the plugin action link were limited to the individual site's WP Admin. This expands both to also work in the Network Admin, which is important because on some multisite configurations regular administrators are not allowed to control plugins.

Changes

includes/Admin/Admin_Page.php

  • add_hooks() now also registers:
    • network_admin_menuadd_and_initialize_network_page
    • the network_admin_plugin_action_links filter → filter_network_admin_plugin_action_links
  • New add_network_page() / add_and_initialize_network_page() — registers the screen under Settings (settings.php) via add_submenu_page() with the manage_network_plugins capability, since the "Tools" menu does not exist in the Network Admin. The screen reuses the existing render_page / initialize_page callbacks, so it behaves the same as in the regular WP Admin.
  • New filter_network_admin_plugin_action_links() — adds the action link in the Network Admin plugins list, pointing at network_admin_url( 'settings.php?page=plugin-check' ) (the page lives under settings.php here instead of tools.php).
  • The shared link-building logic is extracted into a private add_check_action_link() helper; only the base page URL is parameterized, so the existing single-site URLs are unchanged.

Test coverage

tests/phpunit/tests/Admin/Admin_Page_Tests.php

  • test_add_hooks extended to assert the two new Network Admin hooks are registered.
  • test_add_and_initialize_network_page — ensures the admin page is added under settings.php using the Network Admin specific action (skipped on non-multisite).
  • test_filter_network_admin_plugin_action_links — ensures the plugin link is added with the settings.php-based URL via the Network Admin specific filter.

Verified locally on WP 7.0 across both single-site and multisite runs — Admin_Page_Tests passes in both (the network page test is correctly skipped on single-site and executes on multisite). PHPCS and PHPStan are clean on the changed files.

Open WordPress Playground Preview

@github-actions

github-actions Bot commented Jun 4, 2026

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @felixarntz.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: felixarntz.

Co-authored-by: borislav-angelov <bangelov@git.wordpress.org>
Co-authored-by: eclarke1 <clarkeemily@git.wordpress.org>
Co-authored-by: vishalkakadiya <vishalkakadiya@git.wordpress.org>
Co-authored-by: davidperezgar <davidperez@git.wordpress.org>

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

Register the Plugin Check screen on the network_admin_menu hook under
"Settings" (settings.php), since the "Tools" menu does not exist in the
Network Admin. Also surface the plugin action link in the Network Admin
plugins list via the network_admin_plugin_action_links filter, pointing
to the settings.php-based URL.

Fixes WordPress#64

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@borislav-angelov borislav-angelov force-pushed the 64-multisite-support-admin-page branch from 6f9b0a0 to 3d831e9 Compare June 4, 2026 11:30
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.

Add multisite support for admin page

1 participant