Skip to content
SapphireIT Labs
Publish Guard documentation

Hooks and developer API

All hooks are available once the plugin has booted (plugins_loaded, priority 5).

Rule API v2 ÔÇö stability contract

Pro and third-party rules register through sit_wcpg_register_rules. The second argument is the rule API version, so check $api_version >= 2 before relying on anything below.

  • Members tagged @api change only with an API_VERSION bump. That covers removing a member and changing a signature.
  • Additions are not breaking, so a new method or constant does not bump the version. They bump Rule_Registry::API_MINOR instead (1 since 1.2.0), so an add-on that needs one checks API_VERSION === 2 && API_MINOR >= 1.
  • The internal Action Scheduler hooks are not part of the API.

Product_Context::get_save_path() says how the product is being saved. It returns one of the Save_Path constants: classic, quick_edit, bulk_edit, rest, programmatic, crud, scheduled, cli or none. These are the same strings sit_wcpg_should_enforce receives as $source. A checklist read is always none, and no draft or REST payload can set it. A rule can relax itself on one route:

public function check( Product_Context $context, Settings $settings ): Rule_Result {
	if ( Save_Path::REST === $context->get_save_path() ) {
		return $this->skip( __( 'Not checked for API imports.', 'acme' ) );
	}
	return '' === $context->get_sku() ? $this->fail( __( 'Add a SKU.', 'acme' ) ) : $this->pass();
}

sit_wcpg_loaded (action)

do_action( 'sit_wcpg_loaded', ProductPublishGuardPlugin $plugin );

Fires once, as the last step of the plugin’s boot, and only when its requirements passed. An add-on boots here. Plugin::instance(), settings() and registry() are @api.

add_action( 'sit_wcpg_loaded', static function ( ProductPublishGuardPlugin $plugin ): void {
	if ( 2 !== ProductPublishGuardEngineRule_Registry::API_VERSION ) {
		return;
	}
	acme_boot( $plugin->settings() );
} );

sit_wcpg_register_rules (action)

do_action( 'sit_wcpg_register_rules', Rule_Registry $registry, int $api_version );

Fires once per request, after the 12 built-in rules are registered and before anything reads the registry. $api_version is Rule_Registry::API_VERSION; a callback that takes only $registry keeps working. Register your own rules here. A registered rule automatically gets a settings row (enabled + severity), a checklist row, a list-column contribution and, when set to required, publishing enforcement. Its default settings apply until the merchant saves the settings page.

register() returns false, and triggers _doing_it_wrong(), for a duplicate id.

use ProductPublishGuardEngineAbstract_Rule;
use ProductPublishGuardEngineProduct_Context;
use ProductPublishGuardEngineRule_Result;
use ProductPublishGuardEngineSeverity;
use ProductPublishGuardSettingsSettings;

final class Acme_Title_Length_Rule extends Abstract_Rule {
	public function get_id(): string { return 'acme_title_length'; }
	public function get_label(): string { return __( 'Title length', 'acme' ); }
	public function get_group(): string { return 'content'; }        // content|media|pricing|organization|inventory
	public function get_priority(): int { return 15; }               // display order only
	public function get_default_severity(): string { return Severity::WARNING; }

	public function check( Product_Context $context, Settings $settings ): Rule_Result {
		if ( mb_strlen( $context->get_title() ) > 70 ) {
			return $this->warn( __( 'The title is longer than 70 characters.', 'acme' ) );
		}
		return $this->pass();
	}
}

add_action(
	'sit_wcpg_register_rules',
	static function ( $registry ) {
		$registry->register( new Acme_Title_Length_Rule() );
	}
);

Rule contract (ProductPublishGuardEngineRule_Interface):

  • Pure. Read product data only through Product_Context, never through wc_get_product() or get_post_meta(). The context also reflects unsaved editor values and the in-flight save, which a direct read would miss.
  • Independent. No dependence on other rules or on execution order.
  • Return, don’t throw. Use pass(), fail(), warn() or skip(). The validator catches throwables, so one bad rule cannot break the screen, but a throwing rule is a bug.
  • fail() means “not met”. The configured severity then decides whether that is a required failure or a warning. warn() is advisory and never escalated.
  • supports( Product_Context ) returning false leaves the rule out entirely. skip() shows it as not applicable with a reason.
  • get_fix_target() may return [ 'selector' => '#_sku', 'label' => ÔǪ, 'panel' => 'inventory' ] for the “fix” link in the panel. To point one result somewhere else, return $this->fail( ÔǪ )->with_fix( [ ÔǪ ] ): Rule_Result::with_fix() returns an immutable copy with the new target, the way the built-in rules point a variation failure at the Variations tab.
  • Messages are translated literals. Pass numbers through %d placeholders only, never product text such as a title or a SKU.

Reading the product

Besides the v1.0 field accessors (get_title(), get_regular_price(), get_sku(), get_stock_status() and the rest), Product_Context has, since 1.1.0:

MethodReturns
get_type_family()simple, variable, grouped or external (the Type_Family constants), after the sit_wcpg_product_type_family filter.
get_variations()Variation_Data[], the enabled variations, read from storage. Empty unless the family is variable.
get_child_ids()int[], the linked products that still exist (not deleted or trashed). Empty unless the family is grouped.
get_published_child_count()int, how many of those are published. 0 unless the family is grouped.

ProductPublishGuardEngineVariation_Data is an immutable snapshot of one variation: get_id(), get_regular_price(), get_sale_price(), get_sale_from(), get_sale_to(), get_sku(), get_stock_status(), get_manage_stock() (one of Variation_Data::MANAGE_YES, MANAGE_NO, MANAGE_PARENT), get_stock_quantity() (the parent’s under parent-managed stock), get_image_id() and get_gallery_image_ids().

public function check( Product_Context $context, Settings $settings ): Rule_Result {
	if ( Type_Family::VARIABLE !== $context->get_type_family() ) {
		return $this->skip( __( 'Only variable products have variations.', 'acme' ) );
	}

	foreach ( $context->get_variations() as $variation ) {
		if ( 0 === $variation->get_image_id() ) {
			return $this->warn( __( 'A variation has no image of its own.', 'acme' ) );
		}
	}

	return $this->pass();
}

The rule interface and Product_Context are covered by the stability contract above. Variation_Data is not tagged @api, but it keeps working across 1.x.

sit_wcpg_product_type_family (filter)

apply_filters( 'sit_wcpg_product_type_family', string $family, string $type, Product_Context $context );

The family a product type is judged as. $type is the WooCommerce product type, and $family the built-in mapping (see “Product types”). Return one of simple, variable, grouped or external; any other value is ignored and the built-in mapping applies. Use it when a third-party type works like a variable or a grouped product, for example a bundle whose products are linked like a grouped product’s:

use ProductPublishGuardEngineType_Family;

add_filter(
	'sit_wcpg_product_type_family',
	static function ( string $family, string $type ): string {
		return 'bundle' === $type ? Type_Family::GROUPED : $family;
	},
	10,
	2
);

The family decides which rules apply and how: here price, sale_price and stock_status stop judging the bundle as a simple product and skip it. Linked products, though, are read only from a WC_Product_Grouped (its _children), or from the classic form’s grouped_products[] field. A bundle is neither, so it has no linked products in the context and child_products reports it. Leave that rule a warning, or adjust its result for your type through sit_wcpg_validation_result.

sit_wcpg_validation_result (filter)

apply_filters( 'sit_wcpg_validation_result', Validation_Result $result, Product_Context $context );

Filters every completed validation, whether for the editor panel, the REST endpoint, the list column or the publish guard. The same result drives all of them, so a change here also changes enforcement. Return a Validation_Result; any other return value is ignored. The result is immutable. To change it, build a new one:

use ProductPublishGuardEngineValidation_Result;

add_filter(
	'sit_wcpg_validation_result',
	static function ( Validation_Result $result, $context ) {
		if ( ! has_term( 'digital', 'product_cat', $context->get_product_id() ) ) {
			return $result;
		}

		// Digital products need no stock status.
		$results = array_filter(
			$result->get_results(),
			static fn ( $r ) => 'stock_status' !== $r->get_rule_id()
		);

		return Validation_Result::from_results( $context, array_values( $results ), $result->get_settings_hash() );
	},
	10,
	2
);

sit_wcpg_should_enforce (filter)

apply_filters( 'sit_wcpg_should_enforce', bool $enforce, Product_Context $context, string $source );

Decides whether the publish guard applies to this save, after the built-in scope and exclusions. $source is one of classic, quick_edit, bulk_edit, rest, programmatic, crud or scheduled. Return false to exempt a save, for example products created by your own integration:

add_filter(
	'sit_wcpg_should_enforce',
	static function ( bool $enforce, $context, string $source ): bool {
		return 'crud' === $source && doing_action( 'acme_sync' ) ? false : $enforce;
	},
	10,
	3
);

sit_wcpg_can_override_publish_guard (filter)

apply_filters( 'sit_wcpg_can_override_publish_guard', bool $can, int $user_id );

Whether $user_id may publish a product that fails required checks. The default is the publish anyway setting AND manage_woocommerce. For scheduled publishes, the user is the post author.

// Only administrators may override, whatever the setting says.
add_filter(
	'sit_wcpg_can_override_publish_guard',
	static fn ( bool $can, int $user_id ): bool => $can && user_can( $user_id, 'manage_options' ),
	10,
	2
);

sit_wcpg_publish_blocked (action)

do_action( 'sit_wcpg_publish_blocked', int $product_id, int $user_id, string[] $rule_ids, string $save_path );

Fires once when a publish is refused, with the product’s final id, including a new product that only gets its id once the save finishes. $user_id is the user told about it, which is the post author for a scheduled publish. $rule_ids lists the required rules that failed, and $save_path is a Save_Path value. An exception thrown here is caught and cannot change the refusal.

add_action( 'sit_wcpg_publish_blocked', static function ( int $product_id, int $user_id, array $rule_ids, string $save_path ): void {
	acme_count_refusal( $product_id, $rule_ids, $save_path );
}, 10, 4 );

sit_wcpg_publish_overridden (action)

do_action( 'sit_wcpg_publish_overridden', int $product_id, int $user_id, string[] $rule_ids, string $save_path );

Fires once when a user publishes past failing required checks, with the same arguments as sit_wcpg_publish_blocked. The plugin’s own override log listens here.

add_action( 'sit_wcpg_publish_overridden', static function ( int $product_id, int $user_id, array $rule_ids, string $save_path ): void {
	acme_notify_reviewer( $product_id, $user_id, $rule_ids );
}, 10, 4 );

sit_wcpg_settings_hash_salt (filter)

apply_filters( 'sit_wcpg_settings_hash_salt', string $salt );

Adds an add-on’s own configuration to the settings hash, which is part of every checklist cache key and of the readiness signature. Return a short string that changes whenever your configuration does, and append to the value you receive. Anything but a non-empty string is ignored, and a salt longer than 200 characters is replaced by its md5. With no salt the hash is unchanged.

add_filter( 'sit_wcpg_settings_hash_salt', static function ( $salt ) {
	return ( is_string( $salt ) ? $salt : '' ) . '|acme:' . md5( (string) wp_json_encode( get_option( 'acme_rules', array() ) ) );
} );

sit_wcpg_rules_changed (action)

do_action( 'sit_wcpg_rules_changed' );

The plugin never fires this action; add-ons do, after changing anything that alters validation results. The plugin then reads its settings again, drops what it memoized and queues a rebuild of the stored readiness flags, exactly as it does after a settings save.

update_option( 'acme_rules', $rules );
do_action( 'sit_wcpg_rules_changed' );

Extending Publish Guard (rule API 2.1)

Version 1.2.0 adds the extension points an add-on needs to ship rules of its own that read data this plugin does not model. Rule_Registry::API_VERSION is still 2, and Rule_Registry::API_MINOR is 1. Additions bump API_MINOR; a removal or a signature change bumps API_VERSION.

#Extension pointUse it to
S1Rule_Registry::API_MINORdetect that the points below exist
S2sit_wcpg_loadedboot after the plugin
S3Managed_Rule_Interfacedecide per product whether a rule runs, and how strictly
S4fail-open supports()nothing: a rule whose supports() throws is skipped
S5sit_wcpg_settings_hash_saltexpire caches and stored readiness when your configuration changes
S6sit_wcpg_rules_changedask for stored readiness to be rebuilt
S7Product_Context::get_extra(), sit_wcpg_context_extragive rules data of your own, read from storage
S8sit_wcpg_save_request_extrasjudge a field typed in an admin save before it is stored
S9draft.extras, sit_wcpg_draft_extrasjudge the same field in the live checklist
S10sitWcpg.* JavaScript filters, sit_wcpg_editor_script_dependenciessend that field from the editor and watch it for changes
S11sit_wcpg_rule_groupsname a checklist group of your own

tests/fixtures/sit-wcpg-probe/ is a complete add-on built on these and nothing else. It adds one check, “Probe code”, which needs a value in the post meta _probe_code, and tests/Integration/Probe_Addon_Test.php asserts each behaviour through it. Read it as the worked example.

Managed rules

interface Managed_Rule_Interface extends Rule_Interface {
	public function get_severity_for( Product_Context $context ): string;
}

An ordinary rule is switched on and given a severity on the settings screen. A managed rule answers for itself:

  • it runs whenever supports() returns true, and Settings::rule_is_enabled() is not asked;
  • its result carries get_severity_for() when that is a valid Severity, otherwise get_default_severity(), otherwise required;
  • it is never stored, sanitized, hashed or listed on the settings screen.

A rule whose supports(), get_severity_for() or check() throws leaves no row and breaks nothing else. Return false from supports() for a product outside your scope: the rule is then not listed at all, so it cannot block.

final class Probe_Rule extends Abstract_Rule implements Managed_Rule_Interface {
	public function get_id(): string { return 'probe_code'; }
	public function get_label(): string { return __( 'Probe code', 'acme' ); }
	public function get_group(): string { return 'probe'; }

	public function get_severity_for( Product_Context $context ): string {
		return Type_Family::EXTERNAL === $context->get_type_family() ? Severity::WARNING : Severity::REQUIRED;
	}

	public function check( Product_Context $context, Settings $settings ): Rule_Result {
		return '' !== (string) $context->get_extra( 'probe_code', '' )
			? $this->pass()
			: $this->fail( __( 'This product has no probe code.', 'acme' ) );
	}
}

Context extras

$context->get_extra( string $key, $default = null );
$context->with_extras( array $extras ): Product_Context;
Product_Context::from_array( array( 'extras' => array( 'probe_code' => 'abc' ) ) );

Rules read only the context, so data of your own travels as an extra. A key is lowercase letters, digits and underscores, starts with a letter and is at most 40 characters. A value is a scalar, null, or an array of those nested at most three deep; anything else is dropped. A seeded value wins; anything else is resolved by sit_wcpg_context_extra, once per key for each context; null gives $default. Extras are a property of the context, like the save path: no override array can set them. with_extras() returns a copy, and a later seed wins over an earlier one.

Where each path gets its extras:

PathSource
Classic editor, Quick Edit, Bulk Editsit_wcpg_save_request_extras, then sit_wcpg_context_extra for what it left out
CRUD save, REST, scheduled publish, WP-CLI, stored readinesssit_wcpg_context_extra
Live checklist in the editorsit_wcpg_draft_extras, then sit_wcpg_context_extra for what it left out

Leave out a field the request does not carry. An absent field must fall back to the stored value; if you seed it as empty, a Quick Edit will refuse a product that is complete.

sit_wcpg_context_extra (filter)

apply_filters( 'sit_wcpg_context_extra', mixed $value, string $key, Product_Context $context );

Resolves an extra nothing seeded. $value starts as null. Return null for a key that is not yours.

add_filter( 'sit_wcpg_context_extra', static function ( $value, string $key, Product_Context $context ) {
	if ( 'probe_code' !== $key || null === $context->get_product() ) {
		return $value;
	}
	return (string) $context->get_product()->get_meta( '_probe_code' );
}, 10, 3 );

sit_wcpg_save_request_extras (filter)

apply_filters( 'sit_wcpg_save_request_extras', array $extras, array $postarr, string $source, int $post_id );

Runs in the publish guard when $source is one of Save_Path::admin_paths(). $postarr is slashed, exactly as wp_insert_post_data received it, so unslash and sanitize what you read. $post_id is 0 for a new product. A result that is not an array is ignored.

add_filter( 'sit_wcpg_save_request_extras', static function ( $extras, array $postarr, string $source ) {
	if ( is_array( $extras ) && Save_Path::CLASSIC === $source && isset( $postarr['_probe_code'] ) ) {
		$extras['probe_code'] = sanitize_text_field( wp_unslash( $postarr['_probe_code'] ) );
	}
	return $extras;
}, 10, 3 );

sit_wcpg_draft_extras (filter)

apply_filters( 'sit_wcpg_draft_extras', array $extras, array $raw, WC_Product $product );

The validate route accepts draft.extras: an object of at most 50 keys and 20 000 bytes encoded, otherwise the request is refused with 400 sit_wcpg_invalid_draft. Nothing in it is seeded as sent. $raw is that object, unsanitized; return the keys you accept, cleaned. A request that carries extras is never cached.

Checklist_Service::validate_post() and validate_product() take the extras to seed as a third parameter, array $extras = array().

add_filter( 'sit_wcpg_draft_extras', static function ( $extras, $raw ) {
	if ( is_array( $extras ) && is_array( $raw ) && isset( $raw['probe_code'] ) && is_string( $raw['probe_code'] ) ) {
		$extras['probe_code'] = sanitize_text_field( $raw['probe_code'] );
	}
	return $extras;
}, 10, 2 );

Editor JavaScript filters

The editor panel applies three @wordpress/hooks filters:

applyFilters( 'sitWcpg.snapshot.extras', {}, document, window ); //  object
applyFilters( 'sitWcpg.watcher.fields', string[] );              //  string[]
applyFilters( 'sitWcpg.watcher.containers', string[] );          //  string[]
  • sitWcpg.snapshot.extras returns the values of your own controls. A non-empty plain object is sent as draft.extras and takes part in the draft’s signature, so a change to it triggers a new check. Leave a key out when its control is not on the page.
  • sitWcpg.watcher.fields adds selectors, inside the post form, whose input and change events mean the draft changed. Fields inside #woocommerce-product-data are watched already.
  • sitWcpg.watcher.containers adds containers whose children are replaced without an event; they are observed for mutations.

The core selectors cannot be removed, and anything that is not a string is dropped. The filters are read when the panel starts, so your script has to run first:

import { addFilter } from '@wordpress/hooks';

addFilter( 'sitWcpg.snapshot.extras', 'acme/probe', ( extras, doc ) => {
	const field = doc.querySelector( '#_probe_code' );
	return field ? { ...extras, probe_code: field.value } : extras;
} );

sit_wcpg_editor_script_dependencies (filter)

apply_filters( 'sit_wcpg_editor_script_dependencies', string[] $deps );

Adds script handles the editor panel’s script (sit-wcpg-editor) depends on, so they load before it. Register your script first: a handle that is not registered is dropped. The panel’s own dependencies cannot be removed.

add_action( 'admin_enqueue_scripts', static function (): void {
	wp_register_script( 'acme-probe-editor', plugins_url( 'build/editor.js', __FILE__ ), array( 'wp-hooks' ), '1.0.0', true );
}, 5 );

add_filter( 'sit_wcpg_editor_script_dependencies', static function ( $deps ) {
	$deps[] = 'acme-probe-editor';
	return $deps;
} );

sit_wcpg_rule_groups (filter)

apply_filters( 'sit_wcpg_rule_groups', array<string, string> $labels );

Adds checklist groups. A key is lowercase letters, digits and underscores, starts with a letter and is at most 30 characters; the value is its translated label. Added groups follow the five core ones in the order given, ten at most. The core groups keep their labels and positions whatever is returned. The result is used by the editor panel, its no-JavaScript fallback and the settings screen.

add_filter( 'sit_wcpg_rule_groups', static function ( $labels ) {
	$labels['probe'] = __( 'Probe', 'acme' );
	return $labels;
} );

Admin screens (1.2.0)

Version 1.2.0 draws a branded header above every Publish Guard screen: the logo and version, the tabs (Dashboard, Checklist, Live products), a Docs link and, while the upgrade prompts are on, an “Upgrade to Pro” button and a “Channel Readiness” tab linking to the Pro sales page. An add-on can join it. These ship in the same release as rule API 2.1, so Rule_Registry::API_MINOR stays 1.

#Extension pointUse it to
S12sit_wcpg_admin_tabsadd a tab for your own page
S13sit_wcpg_admin_header_itemsshow up to three status pills in the header
S14Admin_Shell::render(), Admin_Shell::STYLE_HANDLE, the --sit-wcpg-* CSS custom propertiesdraw the same header and use the same look on your own page
S15sit_wcpg_show_upgrade_promptshide the Pro prompts on Publish Guard’s screens

Everything an add-on passes in is validated after the filter runs and escaped on output; anything malformed is dropped (and logged when WP_DEBUG is on). The core tabs cannot be removed, replaced or relabelled.

use ProductPublishGuardAdminAdmin_Shell;

add_filter( 'sit_wcpg_admin_tabs', static function ( $tabs ) {
	$tabs[] = array(
		'id'         => 'acme-feeds',
		'label'      => __( 'Feeds', 'acme' ),
		'url'        => admin_url( 'admin.php?page=acme-feeds' ),
		'capability' => 'manage_woocommerce',
	);
	return $tabs;
} );

add_filter( 'sit_wcpg_show_upgrade_prompts', '__return_false' );

// The page callback of `acme-feeds`; enqueue Admin_Shell::STYLE_HANDLE on its screen.
function acme_feeds_page() {
	Admin_Shell::render( 'acme-feeds' );
	echo '<div class="wrap sit-wcpg-ui"></div>';
}

Admin_Shell::render() prints <hr class="wp-header-end"> after the header, so WordPress moves admin notices below it. The stylesheet is registered on every admin request; enqueue it (or list it as a dependency) on your screen. The --sit-wcpg-* custom properties set on .sit-wcpg-ui are part of the API and change only with API_VERSION.

Admin UI kit

Inside an element with the sit-wcpg-ui class, the shell stylesheet sets these custom properties. Use them in your own CSS (color: var(--sit-wcpg-ink)) so an add-on screen keeps the same look. They are @api: renamed or removed only with a new API_VERSION, and tests/fixtures/rule-api-v2.json lists them. The values may be tuned in a minor release.

PropertyValueUse
--sit-wcpg-navy-900#16224Alogo tile, dark surfaces
--sit-wcpg-navy-700#1B2A5Cprimary buttons, active tab underline
--sit-wcpg-shield-500#00A32A“on”, “ready” and progress fills; never text on white
--sit-wcpg-shield-700#0A6B26success text
--sit-wcpg-shield-50#E6F6EBsuccess tint
--sit-wcpg-gold-300#FFD27APro prompts only
--sit-wcpg-ink#0F1834body text
--sit-wcpg-muted#5B6478secondary text
--sit-wcpg-line#E3E7EFborders
--sit-wcpg-line-strong#D5DBE7input and button borders
--sit-wcpg-ground#F4F6FApage and muted backgrounds
--sit-wcpg-surface#FFFFFFcards
--sit-wcpg-required-700, --sit-wcpg-required-50#B42318, #FEECEBrequired, failing
--sit-wcpg-warning-700, --sit-wcpg-warning-50#8A5300, #FFF4DEwarning
--sit-wcpg-info-700, --sit-wcpg-info-50#1B3FA6, #EEF2FClinks, info, focus ring
--sit-wcpg-radius-control, -card, -panel9px, 14px, 16pxcorner radii
--sit-wcpg-space-1  --sit-wcpg-space-84 8 12 16 20 24 32 48 pxspacing
--sit-wcpg-fontInter, then the system UI stacktype

Every text colour above passes WCAG 2.1 AA (4.5:1) on the backgrounds the kit pairs it with: ink and muted on surface and ground, each -700 on its -50 tint and on surface, white on navy-700 and navy-900, navy-900 on gold-300. shield-500 is for fills, not text.

The component classes (sit-wcpg-ui-card, sit-wcpg-ui-button, sit-wcpg-ui-pill, sit-wcpg-ui-switch, sit-wcpg-ui-banner, ÔǪ) style Publish Guard’s own screens. They are not @api: use them if they help, but they may change in any release. Inter ships inside the plugin (assets/fonts/); nothing is loaded from a font service.

sit_wcpg_admin_tabs (filter)

apply_filters( 'sit_wcpg_admin_tabs', array $tabs, string $active );

Adds tabs to the header. Each entry is array{ id: string, label: string, url: string, capability: string, badge?: string }:

  • id matches ^[a-z][a-z0-9-]{0,39}$ and is unique; the first entry with an id wins. dashboard, checklist, live-products and upgrade are Free’s.
  • label (at most 40 characters) and badge (at most 12) are plain text.
  • url is an absolute URL inside this site’s admin (admin_url( ÔǪ )); anything else drops the tab.
  • capability is checked with current_user_can(); a user without it does not see the tab.

At most four add-on tabs are printed, in the order added, after Free’s tabs and before the upgrade tab. $active is the id of the current tab. Admin_Shell::tabs( $active ) returns the validated list.

sit_wcpg_admin_header_items (filter)

apply_filters( 'sit_wcpg_admin_header_items', array $items, string $active );

Adds status pills between the Docs link and the upgrade button. Each entry is array{ id: string, label: string, url?: string, tone?: 'neutral'|'success'|'warning'|'danger' }; the rules for id, label and url are those of sit_wcpg_admin_tabs. A pill with a url is a link. At most three are printed. Free adds none.

sit_wcpg_show_upgrade_prompts (filter)

apply_filters( 'sit_wcpg_show_upgrade_prompts', bool $show = true );

Return false to hide every Pro prompt on Publish Guard’s own screens: the “Upgrade to Pro” header button, the Channel Readiness tab, the Dashboard’s Pro card and the Checklist’s “Need channel rules?” box. Publish Guard Pro returns false whenever it is active. Nothing outside Publish Guard’s screens ever mentions Pro.

Reading readiness from your own code

$service = ProductPublishGuardPlugin::instance()->checklist();

$result  = $service->validate_post( $product_id );          // ?Validation_Result, memoized per request
$summary = $service->get_summary_for_post_id( $product_id ); // ?array, the list-column summary

get_summary_for_post_id() is the one read path for anything that is not the editor. Build on it rather than on validate_post() if you need readiness outside the editor.

REST endpoint

POST /wp-json/sit-wcpg/v1/products/{id}/validate: returns the checklist for a product, optionally with an unsaved draft object overriding stored values. Requires a logged-in user who can edit_post the product, plus the usual REST cookie nonce. The endpoint performs no writes. Its response includes preflight, the decision behind the editor’s one-sentence statement. It exists for the editor panel and is not a stable public API in 1.x.

POST /wp-json/sit-wcpg/v1/review-notice: records the answer to the review request, with choice set to review, later or never. Requires manage_woocommerce and the REST cookie nonce. It exists for the notice’s script and is not a public API.

Last updated:

Black Friday sale

Black Friday: 80% off every Pro plugin

Your first year, on every plan. The coupon is added for you at checkout.

Ends in The offer ends at 00:00 GMT on 5 December 2026.

Claim deal