Skip to content

Preview broken in v1.22.0: admin_debug trigger has no client-side handler #1199

@JustNotesa

Description

@JustNotesa

Description

Popup preview (?popup_preview=...&popup=ID) does not open the popup in v1.22.0.

Steps to Reproduce

  1. Create any popup in PUM
  2. Click "Preview" in the admin
  3. Page loads but popup does not open

Root Cause

Two issues found:

1. Missing client-side handler for admin_debug trigger

The server correctly injects an admin_debug trigger into the popup config when popup_preview is in the URL. However, PUM.triggers is an empty object — no JavaScript code registers a handler for the admin_debug trigger type. The deferred pumInitialized approach from the v1.22.0 fix cannot work if the trigger handler itself does not exist on the client.

2. popmake('open') does not add pum-open CSS class

Calling popmake('open') sets display: block but does not add the pum-open CSS class. This appears to be a regression in v1.22.0.

Environment

  • PUM v1.22.0
  • WordPress 6.9.4
  • PHP 8.1
  • Tested on clean setup: logged in as admin, no caching, correct preview hash

Workaround

add_action('wp_footer', function() {
    if (!isset($_GET['popup_preview'])) return;
    ?>
    <script>
    window.addEventListener('load', function() {
        setTimeout(function() {
            jQuery('.pum').popmake('open');
        }, 500);
    });
    </script>
    <?php
});

Related

This was originally reported in #1181. The fix in v1.22.0 was confirmed as not working — see our comment there. Opening a separate issue for better visibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions