Guide

Privacy Consent migration guide

WP Consent API 2.0 upgrade notes for this plugin and dependent PRC plugins.

Compatibility

WP Consent API 2.0 is additive. Category-based consent (wp_has_consent, wp_set_consent, wp_add_cookie_info) keeps working. No database migration or consent-data rewrite is required.

Composer dependency target: wpackagist-plugin/wp-consent-api ^2.0 (was ^1.0).

What you get in 2.0

Service-level APIs alongside categories:

  • PHP: wp_has_service_consent(), wp_is_service_denied(), wp_set_service_consent()
  • JS: matching wp_*_service_consent helpers
  • Event: wp_consent_api_status_change_service
  • Action: wp_consent_service_changed

When v2 is active, the privacy consent banner can expose per-service toggles under non-essential categories. Default marketing services: meta, pinterest, linkedin, reddit (extend with prc_privacy_consent_services).

Existing category usage

This plugin and other PRC plugins that register cookies with wp_add_cookie_info() continue to use category-based consent. The service name argument on cookie registration feeds v2 service-level features when available.

Optional verification

plugins/prc-privacy-consent/test-consent-api.php exercises v1 and v2 surfaces. Shortcodes such as [test_consent_api] can confirm category and service APIs on a test page after activating WP Consent API 2.0.

  • Architecture
  • Upstream notes in plugins/prc-privacy-consent/WP-CONSENT-UPGRADE.md

Was this helpful?