Test Your WordPress Plugin Before Release. One plugin ZIP connects to two WordPress test windows. The fresh setup shows successful activation, and the update test shows the saved notice “Closed on Friday” both before and after the update.

If you’re working out how to test an AI-generated WordPress plugin, start with the ZIP customers will download. Inspect the package, run the code checks, then install it on a clean site and complete the main workflow. On a second site, use the same ZIP to replace an active older release that already has non-default settings. Compare what WordPress stored with what users see. Test deactivation, uninstall, and any advertised updater, then save the ZIP’s SHA-256 with the results. Jump to the release checklist and copyable test record.

Set up a clean site and an upgrade site

Use two disposable WordPress sites with separate databases. Take a files-and-database snapshot of the clean site before installing the candidate. On the upgrade site, activate the previous public ZIP, save settings a customer might choose, and take a snapshot with those settings in place. The diagram shows the two starting points for the same candidate ZIP.

A single candidate ZIP branches into a clean-install test and an in-place upgrade test before both results are recorded.
An empty site verifies first-time setup, while a seeded site verifies what happens to existing settings.

The clean site starts with a fresh database. The upgrade site starts with the previous version active, saved data in place, and a pre-upgrade snapshot.

Set up a published page and post on each site with fake content. Use separate browser profiles for the administrator, subscriber, and logged-out visitor, and keep page caching off for the baseline run. Before installing the candidate, write down the first-run defaults, who can perform the main workflow, and which options or records it should change. For the upgrade, choose a saved value that could get mistaken for a default, such as a false toggle or a zero limit.

The example uses Site Notice, a small single-site fixture with no required plugins or buyer updater. Both versions use site-notice/site-notice.php and put the form under Settings → Site Notice. Version 2.0.0 starts with the notice off, an empty message, and Posts and pages selected. The upgrade starts from version 1.0.0 with a notice limited to pages. The build source is included below, and the Site Notice values and responses in this walkthrough are acceptance criteria for a test run.

Inspect the release ZIP and run the code checks

Give the archive a versioned filename. In PowerShell, run Get-FileHash -Algorithm SHA256 .\my-plugin-2.0.0.zip. Open the archive and confirm it contains one plugin folder with the main PHP file directly inside. Match the Version header to the changelog and any listing or updater metadata. Check that Requires at least and Requires PHP cover the whole build, including bundled libraries. Look for missing assets or autoload files, and scan for private credentials, customer data, logs, backups, and development files. PowerShell Get-FileHash · WordPress plugin headers.

On a separate disposable instance, install Plugin Check and the candidate. In Tools → Plugin Check, select the candidate and run General, Plugin Repo, Security, Performance, and Accessibility. Save the tool version, selected categories, and report alongside the ZIP hash. The category and readme examples here refer to release 2.2.0. Plugin Check listing · Plugin Check 2.2.0 category definitions.

For a readme warning, open the field the rule refers to. A file-level readme_parser_warnings_too_many_tags warning can mean there are six tags in readme.txt. Trim them to five for a WordPress.org listing. If the distribution channel never uses those tags, record why the directory rule is inapplicable. If the code prints a saved message without escaping it in its HTML context, fix the render call and repeat the scan and public display test. For a verified false positive, record the rule ID, location, and reason. Plugin Check 2.2.0 readme rules · Common security mistakes in AI-generated WordPress plugins.

Run PHP_CodeSniffer with WordPress Coding Standards and a PHP compatibility ruleset. With PHPCompatibilityWP installed and registered, the command below checks extracted release files against the ruleset’s coverage for PHP 8.3 and later. Lint the shipped PHP on the minimum interpreter with php -l, lint shipped JavaScript, and audit the Composer and npm production dependencies that contribute to the ZIP. Record the tool versions. A lint run checks syntax on the interpreter you used. Run the installed workflows on that PHP version as well. WordPress Coding Standards · PHPCompatibilityWP target versions · PHP command-line options.

vendor/bin/phpcs --standard=PHPCompatibilityWP --runtime-set testVersion 8.3- ./unpacked/my-plugin

Install the exact ZIP on a clean site

Use a default theme and install only genuinely required dependencies. In the test site’s wp-config.php, set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false. Mark the current end of wp-content/debug.log. Keep the browser Console and Network panels open through activation, the settings save, and visits to both public URLs. For CL-01 and SET-01, record any new plugin-related PHP warnings or deprecations, script errors, or failed requests beside the action that triggered them. WordPress debugging guide.

  1. CL-01. Go to Plugins → Add Plugin → Upload Plugin, choose the candidate, click Install Now, then Activate Plugin. Verify the candidate version and active state under Installed Plugins. Open the settings screen and check your documented defaults. For Site Notice v2, read the full option before the first save and confirm there are zero notices on both public URLs. Activation and the related screens should add no plugin-related errors. WordPress 7.1.5 menu labels · WordPress ZIP upload instructions.
  2. SET-01. As an administrator, enter Summer hours, enable the notice, and select Pages only. In Network, confirm the POST reaches /wp-admin/admin-post.php with action=sitenotice_save. Expect an HTTP 303 redirect to /wp-admin/options-general.php?page=site-notice&sitenotice_saved=1 and a Settings saved. notice on the destination screen. Reload settings, read the entire option, and visit both URLs logged out. Expect one notice on the page, zero on the post, and clean browser and PHP logs for the workflow.
  3. VAL-01. Submit a whitespace-only message with the notice enabled through the same endpoint. Expect HTTP 422 with Enter a notice message., with no success redirect or success notice. Check that every option key, value, and type matches the pre-submit readback and that the page still shows Summer hours once while the post shows no notice.
  4. AUTH-01. Sign in as a subscriber on the site running the candidate. The Site Notice menu should be absent, and opening /wp-admin/options-general.php?page=site-notice should return a WordPress access denial. Verify the saved option and public output are unchanged. The optional handler test below checks that a subscriber with a valid form nonce is also denied at the write endpoint with HTTP 403 and You cannot change Site Notice settings. There should be no success feedback.
  5. NONCE-01. On the disposable site, sign in as the administrator and open a fresh form. In the browser’s Elements panel, remove the fixture’s hidden sitenotice_nonce field before submitting a benign change such as Winter hours. Expect the POST to return HTTP 403 with The form could not be verified. and no success redirect or notice. Read the entire option again and check that the logged-out page and post still match SET-01.
  6. ESC-01. With a fresh administrator form, save R&D <today> with Pages only selected. Expect the same successful redirect and the exact message in storage. Inspect the logged-out page. Its notice should display the literal text R&D <today> once, with no today element in the DOM. The post should still show zero notices. WordPress HTML text escaping.

Expected v2 option before and after the first save, respectively. The option is sitenotice_settings. The fixture uses an integer data version and a Boolean enabled value. Keep the form screenshot and full option readbacks. A hidden value can change even when the form looks the same.

{"data_version":2,"enabled":false,"message":"","placement":"posts_and_pages"}
{"data_version":2,"enabled":true,"message":"Summer hours","placement":"pages_only"}

Upgrade an older version and verify that settings survive

On the second site, activate Site Notice 1.0.0. Enable the notice, enter Summer hours, and clear Show on posts. Check the public URLs while logged out, then save the full option readback and snapshot both files and database. The legacy key should contain the Boolean false. WordPress preserves Boolean values inside serialized option arrays. A standalone scalar false normally reads back as an empty string on a later database read, so check the type in your own storage. WordPress Options API source.

{"data_version":1,"enabled":true,"message":"Summer hours","show_on_posts":false}
  1. UP-01. Leave v1 active. Upload the candidate through Plugins → Add Plugin → Upload Plugin, click Install Now, compare the versions, and choose Replace current with uploaded. Keep the folder and main filename stable. If the candidate ends up inactive, record a failure and check the installer and PHP log before trying again. A normal plugin update skips the registered activation function. WordPress overwrite screen · WordPress Handbook migration example.
  2. With v2 active, visit the page logged out before saving anything in v2. Read the complete option, reload the page, and read it again. Both readbacks should show the v2 shape below, with the old show_on_posts key gone. Expect one notice on each page load and zero on the post. Open the v2 settings screen and check that Pages only is selected and the original message and enabled state are present.
  3. UP-02. Use the v2 form to save Winter hours while keeping Pages only. Confirm the same successful response as SET-01 and read the complete option again. Only the message should change. Check for one updated notice on the page and zero on the post.
  4. RB-01. Restore the matching v1 files and database from the pre-upgrade snapshot. Confirm v1 is active, its full option is back with Boolean false, and the logged-out page and post show one notice and zero notices, respectively. WordPress files-and-database backup guidance.
{"data_version":2,"enabled":true,"message":"Summer hours","placement":"pages_only"}

After upgrading, verify Pages only and count the notices on both URLs. The illustration shows the expected mapping and public output.

Example settings comparison showing the enabled switch and notice text preserved while a false legacy setting maps to Pages only.
Compare the upgraded settings and public output before opening the settings form to save anything.

Expected behavior. The saved Boolean false becomes pages_only. The page shows one notice and the post shows zero.

Restore the same v1 snapshot for each variation and check the legacy value before installing v2. A saved true and an absent show_on_posts key each map to posts_and_pages in Site Notice, with one notice on each URL when enabled. A disabled notice with a saved message and show_on_posts=false keeps its message, becomes pages_only, and displays zero notices on both URLs. Repeat the upgrade from older directly eligible releases when they use a different data shape. Mark the public upgrade case Not applicable when there has been no public release.

Check lifecycle behavior and advertised compatibility

For LIFE-01, deactivate the plugin and check that its behavior stops and its saved settings remain. Reactivate it and verify that the previous configuration and public output return. For UN-01, work on a disposable copy. Inventory the plugin’s options, tables, scheduled jobs, and files or uploads where applicable. Compare the inventory after deactivation and deletion with the documented cleanup or retention behavior. Site Notice should remove its option on deletion and recreate clean defaults on reinstall. If you offer a remove-data switch, restore the same starting snapshot and test deletion and reinstall with each switch setting. WordPress uninstall methods.

For DEP-01, attempt activation with each required dependency missing or inactive in turn. When the plugin declares the dependency in Requires Plugins, expect WordPress to block activation and identify the unmet requirement. When the plugin handles the dependency itself, verify its documented notice or fallback and confirm that wp-admin and the public site still load. Restore the dependency and run the feature that needs it. WordPress plugin requirement validation.

Start with the three baseline rows below, then add the supported combination most likely to break. As of December 4, 2026, WordPress 7.1.5 was current stable and 7.0.9 is the fixture’s illustrative floor. PHP 8.3 was receiving security fixes, and PHP 8.5 was in active support and was the newest branch listed in the WordPress core compatibility table. PHP 8.6 had shipped on November 19. Use patched versions unless you’re deliberately recreating a historical environment, and record the exact WordPress, PHP, theme, browser, and dependency versions. WordPress release archive · WordPress core PHP compatibility table · PHP support dates · PHP patch changelog · PHP 8.6 release announcement.

Illustrative test rowWhat to run
Baseline, minimum core and PHP
WordPress 7.0.9 / PHP 8.3.37
Clean install, save and rejection cases, upgrade, rollback, and lifecycle.
Baseline, current core and supported PHP
WordPress 7.1.5 / PHP 8.5.13
Repeat the baseline cases with current supported dependencies and exercise the advertised workflows.
Baseline, current core at the PHP floor
WordPress 7.1.5 / PHP 8.3.37
Repeat the baseline cases and the main workflow for any dependency used on this pairing.
Extra supported combination
WordPress 7.0.9 / PHP 8.5.13
Exercise activation, save, rendering, and upgrade on older core with newer PHP if you advertise that pairing. A plugin with a required integration may also need current core with the minimum dependency version.
Below the declared WordPress floor
WordPress 6.9.12 / PHP 8.3.37
Attempt installation and activation on a disposable site. Expect core to identify the minimum-version requirement and keep the plugin inactive. Verify wp-admin and a public page still load.

Give an advertised path its own row if it uses a different storage engine, activation mode, dependency API, or buyer interface. For a WooCommerce plugin that claims both Checkout block and HPOS support together, place an order through the block with HPOS enabled. For advertised multisite support, test network and per-site activation, initialization of a new site, and where settings are scoped. Run the buyer’s main workflow in the browsers you support and verify that keyboard users can reach and operate every required control. WooCommerce compatibility guidance.

If the plugin schedules work, run each scheduled event on staging and verify its result. For remote services, test both invalid credentials and a controlled outage. Check the user-facing response, saved data, and whether unrelated features still work. For storage-heavy workflows, run the main operation with an empty dataset and with a volume representative of buyers.

Release checklist and test record

  • Match the final ZIP’s SHA-256 to the scan, clean-install, save and rejection cases, upgrade and rollback, lifecycle, and compatibility records. If the ZIP changes, hash and inspect it again. Repeat clean activation, applicable upgrade checks, and any affected workflow from its original starting state.
  • Mark Pass when the observed result matches the expected result and the record points to evidence. Use Fail for a mismatch, Blocked for a missing prerequisite, and Not applicable with a reason when the case falls outside the release. For UP-01, keep the old and new option readbacks plus the logged-out results for both URLs.
  • Ready to submit means the exact package has passed the applicable checks you can run before submission and substantive findings are resolved. If package delivery requires channel approval, record the candidate-delivery case as Blocked, with its prerequisite and owner. Ship after all applicable release gates pass, including delivery through each advertised buyer updater. For Hold, list the failing or blocked case IDs beside the ZIP hash.
Candidate ZIP, version, SHA-256:
Run date, time and time zone:
Previous ZIP, version, SHA-256:
Scanner versions, categories and report:

Case ID:
Environment (site and snapshot, WordPress, PHP, theme, browser,
dependencies, channel and license mode where relevant):
Starting state:
Steps:
Expected result:
Observed result:
Status (Pass / Fail / Blocked / Not applicable):
Evidence or applicability reason:
Blocking prerequisite, owner and verification window if applicable:

Submission decision:
Public release decision (Ship / Hold) and relevant case IDs:

Example UP-01 entry before a run. Start with v1.0.0 active, the full v1 array recorded above, and one notice on the page. Expect v2.0.0 active, the full v2 array on two successive reads, one notice per page load, and zero on the post. Fill in the actual hash, run date, exact theme and browser versions, and observed results after running the two ZIPs. The option arrays above specify the expected before-and-after values.

Verify delivery through the buyer’s updater

Keep the local ZIP replacement under UP-01. Use a separate production-channel case for an update between releases the channel already offers, if available. That run exercises the real buyer setup and gives you evidence about that pair of packages. Record delivery of the candidate itself under CH-01. If the channel lacks the candidate, record Blocked and assign the release owner to run CH-01 at the first controlled opportunity after the package becomes available. Keep broad rollout on hold for an advertised updater until CH-01 passes.

  1. Start with a clean snapshot of a controlled site running an older eligible build. Use a valid buyer entitlement for a licensed product or the documented unlicensed setup. Turn off developer mode and use the buyer’s normal update screen.
  2. Clear the channel’s discovery cache using its documented procedure and clear WordPress’s plugin update transient if needed. On the controlled site, use wp transient delete update_plugins --network and open Dashboard → Updates → Check again. Confirm the channel actually received a fresh discovery request using a timestamped, redacted updater log or provider-side request record. Save the version offered and check time. If an eligible buyer sees no update or the wrong version after a confirmed fresh check, record Fail. WP-CLI transient deletion · WordPress Updates screen source.
  3. Install through the normal buyer flow. If your controlled environment can preserve the ZIP from that download, hash it and compare with the approved channel archive. Otherwise, hash each installed plugin file and compare the paths and hashes with a manifest built from the approved channel package. Record the installed version, active state, complete saved settings, and main workflow result. Keep signed download URLs and credentials out of the evidence. Record Fail for a download error, wrong package, or settings regression.

For example, a licensed WPBay check starts on an eligible older build with an actual buyer entitlement and Developer Mode off. Confirm the offered version in the normal WordPress Plugins update screen, then use the delivery checks above. Before approval, the SDK’s Developer Testing Purchase Code and an allowed testing slug let you check sandbox activation. Record that result separately. Developer Mode skips real checks against WPBay’s production licensing server. On a licensed channel, also confirm that an ineligible account cannot obtain the restricted package and that its installed build and settings stay intact. WPBay SDK documentation, sections 3.3, 6, and 7.

Optional checks for migrations and save handlers

Read the option and control the first upgrade request

Run WP-CLI from the intended site’s WordPress root or pass --path with the absolute path. Check wp option get home --skip-plugins --skip-themes against your test URL before changing anything. Use the same readback command before and after a save or migration. The skip flags stop ordinary plugin and theme code from loading. Must-use plugins still load, and the command reads through the Options API. Keep persistent object caching off for the isolated run. If a must-use plugin, drop-in, or filter affects the read, inspect the stored row with a database viewer or read-only SQL using the actual options table name. WP-CLI option readback · WP-CLI database query reference.

wp option get sitenotice_settings --format=json --skip-plugins --skip-themes
wp db query "SELECT option_value FROM wp_options WHERE option_name = 'sitenotice_settings'"

The dashboard can load v2 before your first logged-out visit. If you need to observe the request that triggers migration, restore the v1 snapshot on an isolated site. Pause incoming traffic, uptime monitors, external cron and queue runners, and WordPress’s own scheduled processing for the test window. Disable page caching, close any open dashboard tabs, and keep workers paused until you’ve taken the second readback. With the old plugin active, replace its ZIP without loading ordinary plugins or themes. Check the candidate version, active state, and still-legacy option with skipped loading. Then allow one deliberate page request and read the option again. Repeat the same request and verify that migration does not write again or enqueue duplicate work. WP-CLI ZIP replacement · WP-CLI plugin details.

wp plugin install /path/to/candidate.zip --force --skip-plugins --skip-themes
wp plugin get site-notice --fields=version,status --format=json --skip-plugins --skip-themes

To test the missing legacy key, remove just that key from a fresh v1 snapshot with wp option patch delete sitenotice_settings show_on_posts --skip-plugins --skip-themes. For migrations with several writes or jobs, test an interrupted run by injecting a controlled failure between the first side effect and completion. Retry from that partial state and compare the final data and queued work with an uninterrupted run. WP-CLI option patch reference.

Trace and test the save callback

Find the hook that handles the form and check what WordPress passes to its callback. In WordPress 7.0.9, the authenticated branch in admin-post.php calls do_action() with only the dynamic hook name. Core inserts an empty string when the argument list is empty, and add_action() accepts one argument by default. An untyped required parameter can receive that string without raising a PHP error. The hook supplies no request object. Site Notice registers a callback with zero accepted arguments and reads its form fields itself. On the minimum stack, require both the correct saved value and a clean PHP log. Tagged admin-post call site · Tagged hook dispatch and registration.

In the handler, check who can write and how the submitted message is validated. Site Notice checks manage_options before verifying the form nonce. It accepts a bounded, single-line UTF-8 message and escapes it when printing it as HTML text. Review the capability check independently of the nonce check. WordPress nonce guidance.

For an automated denial check, use a configured WordPress PHPUnit test library and disposable test database. In tests/bootstrap.php, require the library’s includes/functions.php, then register a tests_add_filter( 'muplugins_loaded', ... ) callback that requires the main PHP file from the extracted candidate. After registering that filter, require the test library’s includes/bootstrap.php so the plugin is present during WordPress startup. With phpunit.xml.dist pointing to your bootstrap and test directory, run vendor/bin/phpunit -c phpunit.xml.dist --filter Site_Notice_Save_Test for a test class of that name. WP-CLI plugin test bootstrap template · WordPress guide to plugin tests.

In each WP_UnitTestCase, seed the entire v2 option from SET-01, create a user with the test factory, set the current user, and set up a POST using the form’s fields and a benign Winter hours message. For AUTH-01, generate the valid nonce after switching to the subscriber. For NONCE-01, use the administrator and omit it. Dispatch do_action( 'admin_post_sitenotice_save' ). Catch WPDieException in the test body so you can assert its HTTP 403 response code and the case-specific message, then use assertSame() on the full option. Fail if the rejection never occurs, and reset the user and request globals in teardown. SET-01 still covers the packaged form and real HTTP endpoint. Tagged WordPress test handler for wp_die().

Build the two Site Notice test ZIPs

Create v1/site-notice and v2/site-notice in a scratch directory. Save the following file as site-notice.php in both folders. Replace @VERSION@ and @SCHEMA@ with 1.0.0 and 1 in the v1 copy, and with 2.0.0 and 2 in the v2 copy. Use UTF-8 without a byte order mark and run this fixture on disposable single-site installs.

<?php
/**
 * Plugin Name: Site Notice
 * Version: @VERSION@
 * Requires at least: 7.0.9
 * Requires PHP: 8.3
 * Update URI: false
 * Text Domain: site-notice
 */

namespace WPBay\SiteNoticeFixture;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

const SCHEMA = @SCHEMA@;
const OPTION = 'sitenotice_settings';
const SCREEN = 'options-general.php?page=site-notice';
const SAVE_ACTION = 'sitenotice_save';

function settings( $enabled, $message, $show_on_posts ) {
	$values = array(
		'data_version' => SCHEMA,
		'enabled'      => $enabled,
		'message'      => $message,
	);
	if ( 1 === SCHEMA ) {
		$values['show_on_posts'] = $show_on_posts;
	} else {
		$values['placement'] = $show_on_posts ? 'posts_and_pages' : 'pages_only';
	}
	return $values;
}

add_action( 'init', function () {
	$saved = get_option( OPTION );
	if ( false === $saved ) {
		add_option( OPTION, settings( false, '', true ) );
	} elseif ( 2 === SCHEMA && 1 === ( $saved['data_version'] ?? null ) ) {
		update_option( OPTION, settings( $saved['enabled'], $saved['message'], $saved['show_on_posts'] ?? true ) );
	}
} );

add_action( 'admin_menu', function () {
	add_options_page( 'Site Notice', 'Site Notice', 'manage_options', 'site-notice', __NAMESPACE__ . '\\render_settings' );
} );

function render_settings() {
	if ( ! current_user_can( 'manage_options' ) ) {
		wp_die( esc_html__( 'You cannot change Site Notice settings.', 'site-notice' ), '', array( 'response' => 403 ) );
	}
	$saved = get_option( OPTION, settings( false, '', true ) );
	$placement = $saved['placement'] ?? 'posts_and_pages';
	?>
	<div class="wrap">
		<h1>Site Notice</h1>
		<?php if ( '1' === ( $_GET['sitenotice_saved'] ?? '' ) ) : ?>
			<?php wp_admin_notice( __( 'Settings saved.', 'site-notice' ), array( 'type' => 'success' ) ); ?>
		<?php endif; ?>
		<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
			<input type="hidden" name="action" value="sitenotice_save">
			<?php wp_nonce_field( SAVE_ACTION, 'sitenotice_nonce' ); ?>
			<p><label><input type="checkbox" name="enabled" value="1" <?php checked( $saved['enabled'] ); ?>> <?php esc_html_e( 'Enable notice', 'site-notice' ); ?></label></p>
			<p><label><?php esc_html_e( 'Message', 'site-notice' ); ?> <input type="text" name="message" value="<?php echo esc_attr( $saved['message'] ); ?>"></label></p>
			<?php if ( 1 === SCHEMA ) : ?>
				<p><label><input type="checkbox" name="show_on_posts" value="1" <?php checked( $saved['show_on_posts'] ?? true ); ?>> <?php esc_html_e( 'Show on posts', 'site-notice' ); ?></label></p>
			<?php else : ?>
				<p><label><?php esc_html_e( 'Placement', 'site-notice' ); ?>
					<select name="placement">
						<option value="posts_and_pages" <?php selected( $placement, 'posts_and_pages' ); ?>><?php esc_html_e( 'Posts and pages', 'site-notice' ); ?></option>
						<option value="pages_only" <?php selected( $placement, 'pages_only' ); ?>><?php esc_html_e( 'Pages only', 'site-notice' ); ?></option>
					</select>
				</label></p>
			<?php endif; ?>
			<?php submit_button(); ?>
		</form>
	</div>
	<?php
}

add_action( 'admin_post_sitenotice_save', function () {
	if ( ! current_user_can( 'manage_options' ) ) {
		wp_die( esc_html__( 'You cannot change Site Notice settings.', 'site-notice' ), '', array( 'response' => 403 ) );
	}
	$nonce = $_POST['sitenotice_nonce'] ?? '';
	if ( ! is_string( $nonce ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $nonce ) ), SAVE_ACTION ) ) {
		wp_die( esc_html__( 'The form could not be verified.', 'site-notice' ), '', array( 'response' => 403 ) );
	}

	$enabled = '1' === ( $_POST['enabled'] ?? '' );
	$raw_message = $_POST['message'] ?? null;
	$message = is_string( $raw_message ) ? trim( wp_unslash( $raw_message ) ) : '';
	if ( $enabled && '' === $message ) {
		wp_die( esc_html__( 'Enter a notice message.', 'site-notice' ), '', array( 'response' => 422 ) );
	}
	// Keep literal angle brackets in this text field. Escape for the output context.
	if ( ! is_string( $raw_message ) || strlen( $message ) > 160 || 0 !== preg_match( '/\p{Cc}/u', $message ) ) {
		wp_die( esc_html__( 'Enter a single-line notice of up to 160 bytes.', 'site-notice' ), '', array( 'response' => 422 ) );
	}

	if ( 1 === SCHEMA ) {
		$show_on_posts = '1' === ( $_POST['show_on_posts'] ?? '' );
	} else {
		$placement = $_POST['placement'] ?? '';
		if ( ! in_array( $placement, array( 'posts_and_pages', 'pages_only' ), true ) ) {
			wp_die( esc_html__( 'Choose a valid placement.', 'site-notice' ), '', array( 'response' => 422 ) );
		}
		$show_on_posts = 'posts_and_pages' === $placement;
	}

	$next = settings( $enabled, $message, $show_on_posts );
	if ( ! update_option( OPTION, $next ) && $next !== get_option( OPTION ) ) {
		wp_die( esc_html__( 'Settings could not be saved.', 'site-notice' ), '', array( 'response' => 500 ) );
	}
	wp_safe_redirect( admin_url( SCREEN . '&sitenotice_saved=1' ), 303 );
	exit;
}, 10, 0 );

add_action( 'wp_footer', function () {
	if ( ! is_singular( array( 'post', 'page' ) ) ) {
		return;
	}
	$saved = get_option( OPTION, array() );
	if ( empty( $saved['enabled'] ) ) {
		return;
	}
	$pages_only = 1 === SCHEMA
		? false === ( $saved['show_on_posts'] ?? true )
		: 'pages_only' === ( $saved['placement'] ?? '' );
	if ( ! $pages_only || is_page() ) {
		echo '<p id="site-notice">' . esc_html( $saved['message'] ) . '</p>';
	}
} );

Save this as uninstall.php in each site-notice folder. The fixture creates one option and uses no custom tables, scheduled jobs, or uploads.

<?php
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

delete_option( 'sitenotice_settings' );

From the scratch directory, create and hash both archives. Open each ZIP and check that the two PHP files are inside its site-notice folder. Keep the exact v2 archive for both sites. PowerShell Compress-Archive directory layout.

Compress-Archive -Path .\v1\site-notice -DestinationPath .\site-notice-1.0.0.zip
Compress-Archive -Path .\v2\site-notice -DestinationPath .\site-notice-2.0.0.zip
Get-FileHash -Algorithm SHA256 -Path .\site-notice-1.0.0.zip, .\site-notice-2.0.0.zip

Prepare a WPBay submission

As of December 4, 2026, WPBay requires sellers to test the final packaged ZIP. Cover clean activation, the main workflow, settings and roles, lifecycle behavior, and upgrades from the previous public version where applicable. Test the oldest declared WordPress version when reasonably available, current stable WordPress, the PHP floor and a current supported PHP release, and current supported versions of required dependencies. Section 22 also calls for current Plugin Check, WordPress Coding Standards, a PHP compatibility ruleset, linting, applicable dependency audits, and a scan for credentials, malware indicators, and development artifacts. For complex or high-risk paths, have repeatable tests for the relevant failures, concurrency, retries, and duplicate events. Technical requirements §18, compatibility · Technical requirements §22, testing.

Package the production files, readme, license, changelog, and applicable third-party notices and runtime templates. Include translation templates if you present the plugin as translation-ready. For compiled, bundled, or minified first-party runtime assets, include readable source and reproducible build instructions or supply them for review. Check the final upload against the seller checklist. Technical requirements §2.3, package contents · Technical requirements §24, pre-submission checklist.

If buyers use AI features, put a visible AI Information section in the description or documentation. Cover the functionality, providers or models, data sent and why, prompt and output storage, any separate credentials, costs and limits, what stops during an outage, applicable local hosting requirements, and important limitations. Explain what the AI can do without individual confirmation, including whether it can publish automatically. Technical requirements §20.4, AI and content-generation plugins.

You can include the run record with your submission so the reviewer can reproduce the upgrade. A human reviewer uses appropriate automated checks, manual inspection, and practical tests tailored to the release’s features and risk. Approval applies to the recorded release, and material updates may receive further review. After approval, maintain advertised compatibility, fix significant bugs, prioritize security issues, and keep a meaningful changelog. WPBay’s product review process · WPBay submission, lifecycle, and maintenance guidance.

Sample reviewer note for an optional attachment. The attached run record identifies the submitted ZIP by version and SHA-256 and lists the tested environments. To reproduce UP-01, install the previous release, enable the notice, set the message to Summer hours, and clear Show on posts. Replace the active build with the submitted ZIP and open the two logged-out URLs before saving settings. See the attached readbacks and captures for the observed migration and the record for any channel checks awaiting package availability.

Frequently asked questions

Is WordPress Plugin Check enough to ship?

A clean report means the selected checks returned no findings. Plugin Check can inspect files and run certain checks in a controlled runtime. Use an installed workflow to verify that the right user can save, that stored values migrate correctly, and that buyers see the intended result. Plugin Check 2.2.0 technical overview.

Do I need a staging site as well as a clean install?

A fresh local install covers first-run behavior for a self-contained plugin like Site Notice. Add representative staging when a theme, cache, or other plugin affects the feature. If you promise the notice works with page caching enabled, prime the cache, change placement, then check the logged-out response after the documented cache refresh.

Which WordPress and PHP versions should I test?

Read the plugin headers and the requirements of every shipped dependency. Start with the oldest supported pairing and current stable WordPress on a supported PHP branch, then test the core and PHP combinations or dependencies that exercise your riskiest advertised paths. Record exact patches and give any unsupported-version refusal its own case.

What if this is my first public release?

If a beta created data that will carry into the public build, run the upgrade and snapshot procedure from that beta. Record its version and hash so the result is tied to the build that wrote the old data.

Can I sell an AI-generated plugin on WPBay?

Yes. WPBay applies its ordinary product standards, and sellers are responsible for reviewing, testing, and maintaining the code. Routine AI coding assistance needs no listing disclosure when the product has no AI functionality, while customer-facing AI has its own disclosure requirements. Any included AI-generated assets must be ancillary to the software, accurately disclosed, and lawful to use and redistribute. WPBay’s AI policy · Policy section on included AI-generated material.

Last reviewed: December 4, 2026.