Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short-circuit save_alert_inline_edit when in customizer #898

Merged
merged 1 commit into from Dec 6, 2016

Conversation

Projects
None yet
2 participants
@westonruter
Copy link
Contributor

commented Nov 25, 2016

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.

@lukecarbis lukecarbis merged commit 03db164 into develop Dec 6, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@lukecarbis lukecarbis deleted the bugfix/customizer-performance branch Dec 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.