[wp-trac] [WordPress Trac] #31897: Update Customizer nonces via Heartbeat API
WordPress Trac
noreply at wordpress.org
Wed Feb 24 16:15:37 UTC 2016
#31897: Update Customizer nonces via Heartbeat API
-------------------------+-----------------------------
Reporter: westonruter | Owner: voldemortensen
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Customize | Version: 3.4
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
-------------------------+-----------------------------
Comment (by westonruter):
Replying to [comment:16 joeyblake]:
> My inclination when adding the filter to 'heartbeat_received' to refresh
the nonces would be to have the logic and filter inside class-wp-
customize-manager.php. However, when adding the filter there, it never
gets executed.
Good point. This is due to the heartbeat requests being made without the
`wp_customize=on` POST param, and so the `WP_Customize_Manager` doesn't
get bootstrapped. For the logic for how the class gets bootstrapped, see:
https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-
includes/theme.php?marks=1985-2007#L1985
Perhaps the Customizer should also get bootstrapped if the
`heartbeat_received` includes `wp_customize=on`?
Actually, I just remembered this is something that @valendesigns and I
have done in the Customize Concurrency feature plugin.
Here's the `heartbeat_settings` and `heartbeat_received` filters:
https://github.com/xwp/wp-customize-
concurrency/blob/dcaf1d421cc2d546ea0cdb9b97b60d8de9327a13/php/class-
customize-concurrency.php#L221-L273
Notice the injection of the `screenId` which would not get set by default
when loading heartbeat from the Customizer. And then notice how this
`screenId=customize` is used as a signal to bootstrap the Customizer if
not already instantiated in the `heartbeat_received` filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31897#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list