Skip to content

Conversation

westonruter
Copy link
Contributor

This fixes a severe performance problem I encountered when the Customize Posts and JS Widgets plugin are both active. The customizer allows for modifications to many posts to be bundled in a single changeset. Also, in the customizer, the wp_insert_post_data filters may be manually applied in order to obtain a sanitized value for previewing. See class-wp-customize-post-setting.php. This means the wp_insert_post_data filter could be applied many times for a given customizer preview request in order to obtain the post value for preview, and this was causing responses to slow down 5x in my tests, and even to fail entirely. The filter is applying without the value being then saved to the DB, and so no alert should be triggered.

Important: In general, all Stream hooks should no-op unless the customize_save action was done, as this indicates that the changes are actually being persisted to the DB. Otherwise, if is_customize_preview() (if the customizer is active) then no logging should be done at all since it is a preview state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants