Skip to content
GPLWP Guides

How to test a WordPress plugin

Developer Tools Time About 30–60 minutes for a manual test; longer for automated coverage 6 steps Updated 30 Oct 2026

DEVELOPER TOOLS
The short answer

Test a WordPress plugin on a disposable local or staging site, not on production. Check activation, deactivation, uninstall behaviour, front-end and admin flows, error logs, compatibility, and repeatable PHP tests. For a quick smoke test, use a lightweight fixture plugin.

The route
  1. 01Define the cases to test
  2. 02Create an isolated test site
  3. 03Turn on development logging
  4. 04Run the manual lifecycle tests
  5. 05Add repeatable PHP tests
  6. 06Use the fast smoke-test route

What you need

  • A local or staging WordPress site
  • The plugin ZIP or source code
  • Admin access
  • Docker and Node.js if using wp-env

Define the cases to test

Write down what the plugin is meant to change before you activate it. Include its settings screen, shortcodes or blocks, front-end output, permissions, forms, emails, scheduled tasks, REST or AJAX requests, and any third-party service it calls.

Also include failure cases: empty fields, invalid values, logged-out visitors, users without the required capability, fresh installation, upgrade from an older version, and a site where another common plugin is active.

Create an isolated test site

Use a local site or staging copy with a database backup. Do not test an unfamiliar or unfinished plugin on a live site because activation can create a fatal error, change stored data, or add scheduled tasks that continue running.

For a repeatable local setup, install Docker and Node.js, install @wordpress/env, move into the plugin directory, and run wp-env start. WordPress documents this as a local environment for building and testing plugins; the default dashboard is available at http://localhost:8888/wp-admin.

Turn on development logging

Enable WP_DEBUG and WP_DEBUG_LOG on the local or staging site, and set WP_DEBUG_DISPLAY to false if you do not want errors printed into page output. Review wp-content/debug.log after every test run, including browser actions that use AJAX or the REST API.

Clear or record the old log before starting a new test. Debug mode is for development and staging, not for a public production site.

Run the manual lifecycle tests

Install the plugin, activate it, and check that the expected settings, database tables, rewrite rules, widgets, blocks, or scheduled events appear. Visit the front end while logged in and logged out, then test each setting and normal user workflow.

Deactivate the plugin and confirm that the site still loads. If the plugin documents removal behaviour, uninstall it on a disposable copy and check whether its options and custom tables are removed as intended. WordPress treats deactivation and uninstall as different operations, so testing only the deactivate button can miss data-cleanup bugs.

Add repeatable PHP tests

For plugin code that will be maintained, add PHPUnit tests for functions and classes, then integration tests for behaviour that depends on WordPress. WP-CLI can scaffold the usual test files with wp scaffold plugin-tests plugin-name --ci=github; the generated setup includes a bootstrap file, PHPUnit configuration, an installation script, and a sample test.

Run the tests against a clean WordPress database and repeat them after changing the plugin. If the test environment reports that its WordPress test library is missing, remove the incomplete temporary test directories and run the installation command again rather than debugging the plugin code first.

Use the fast smoke-test route

If you only need to check that a plugin can be activated, loaded, and exercised without building a full test suite, use a disposable WordPress install and a small test fixture. benign-plugin-test may fit that narrow use: choose it as a lightweight fixture for benign plugin testing, not as a production feature.

The manual route is still the better option when you need compatibility checks, lifecycle cleanup, user permissions, database behaviour, or automated regression tests. A fixture can expose a basic environment problem quickly, but it cannot prove that your real plugin works across themes, PHP versions, WordPress versions, or other plugins.

The fast route

Let benign-plugin-test do it

Appears intended for benign plugin testing; choose it only when you need a lightweight test fixture rather than a production feature.

Get benign-plugin-test

Sources

  1. developer.wordpress.org /block-editor/reference-guides/packages/packages-env/?utm_so…
  2. developer.wordpress.org /advanced-administration/debug/debug-wordpress/?utm_source=o…
  3. developer.wordpress.org /plugins/plugin-basics/activation-deactivation-hooks/?utm_so…
  4. developer.wordpress.org /news/2025/12/how-to-add-automated-unit-tests-to-your-wordpr…

Questions

Can I test a WordPress plugin on my live site?
You should not test an unfamiliar or unfinished plugin directly on a live site. Use a local or staging copy because activation may cause a fatal error, alter database data, schedule background tasks, or conflict with another plugin. Take a database and file backup before testing on staging, and keep debugging enabled only in that non-public environment.
What should I test after activating a plugin?
After activation, test the plugin’s settings, front-end output, admin screens, user permissions, forms, emails, scheduled actions, REST or AJAX requests, and integrations. Repeat the important flows while logged out and with a user who lacks administrator permissions. Check the debug log after each flow because warnings can be hidden when the page appears to work.
What is the difference between deactivating and uninstalling a plugin?
Deactivation stops a plugin from running but normally leaves its settings and stored data in place. Uninstalling is the removal step and may delete options, custom tables, files, or other data if the plugin implements cleanup. Test both actions separately on a disposable site, and do not assume that deactivation proves uninstall works.
Do I need PHPUnit to test a WordPress plugin?
You do not need PHPUnit for a one-off manual smoke test, but automated PHP tests are worthwhile for a plugin that will be updated or distributed. Manual checks find broken screens and workflows; PHPUnit and WordPress integration tests catch regressions repeatedly. A local environment such as wp-env can provide the WordPress and PHPUnit tooling needed for repeatable tests.