Make WordPress Core


Ignore:
Timestamp:
01/29/2019 09:28:57 PM (6 years ago)
Author:
peterwilsoncc
Message:

Customize: Remove wp_targeted_link_rel pre-save filter from change-sets.

The pre-save filters added to links in [43732] could invalidate JSON data when saving Customizer change-sets.

This removes the filters when saving and publishing change-sets.

Props peterwilsoncc, nikeo for testing.
See #45292.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r44580 r44714  
    28862886        add_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ), 5, 3 );
    28872887
    2888         // Update the changeset post. The publish_customize_changeset action will cause the settings in the changeset to be saved via WP_Customize_Setting::save().
     2888        /*
     2889         * Update the changeset post. The publish_customize_changeset action
     2890         * will cause the settings in the changeset to be saved via
     2891         * WP_Customize_Setting::save().
     2892         */
     2893
     2894        // Prevent content filters from corrupting JSON in post_content.
    28892895        $has_kses = ( false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ) );
    28902896        if ( $has_kses ) {
    2891             kses_remove_filters(); // Prevent KSES from corrupting JSON in post_content.
     2897            kses_remove_filters();
     2898        }
     2899        $has_targeted_link_rel_filters = ( false !== has_filter( 'content_save_pre', 'wp_targeted_link_rel' ) );
     2900        if ( $has_targeted_link_rel_filters ) {
     2901            wp_remove_targeted_link_rel_filters();
    28922902        }
    28932903
     
    29192929            }
    29202930        }
     2931
     2932        // Restore removed content filters.
    29212933        if ( $has_kses ) {
    29222934            kses_init_filters();
    29232935        }
     2936        if ( $has_targeted_link_rel_filters ) {
     2937            wp_init_targeted_link_rel_filters();
     2938        }
     2939
    29242940        $this->_changeset_data = null; // Reset so WP_Customize_Manager::changeset_data() will re-populate with updated contents.
    29252941
Note: See TracChangeset for help on using the changeset viewer.