Skip to content

Normalize Assets Manager current-page exception IDs #96

@mehul0810

Description

@mehul0810

Finding

Assets Manager current-page exceptions are saved from POST payload values, while runtime checks compare them against get_queried_object_id() using strict comparison.

Impact

A rule such as “disable everywhere, but enable on current URL” can fail when the saved current-page ID is stored as a string and the runtime current object ID is an integer. That makes per-page asset exceptions unreliable.

Suggested implementation

  • Cast current-page IDs to integers before persisting them in perform_assets_manager_options.
  • Normalize existing saved current arrays when reading or updating rules.
  • Use strict comparisons after both sides have the same type.
  • Preserve the existing option key and nested array contract.

Acceptance criteria

  • A current-page exception works after saving and reloading the page.
  • Existing saved current-page exceptions continue to work after normalization.
  • Disabling everywhere with a current-page exception still disables the asset on other pages.
  • Add regression coverage around current-page exception save/read behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: assets-managerAsset Manager behavior, compatibility, UI, persistence, or per-page controls.area: compatibilityWordPress, PHP, multisite, WooCommerce, theme, or plugin compatibility.bugConfirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.priority: mediumUseful or user-impacting work that should be planned but is not blocking now.risk: backward-compatibilityTouches public data, options, hooks, migrations, or established behavior.status: in-progressWork has a branch, PR, or active release branch implementation path.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions