WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/29/2019 09:28:57 PM (11 months 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/formatting.php

    r44691 r44714  
    30973097
    30983098/**
     3099 * Adds all filters modifying the rel attribute of targeted links.
     3100 *
     3101 * @since 5.1.0
     3102 */
     3103function wp_init_targeted_link_rel_filters() {
     3104    $filters = array(
     3105        'title_save_pre',
     3106        'content_save_pre',
     3107        'excerpt_save_pre',
     3108        'content_filtered_save_pre',
     3109        'pre_comment_content',
     3110        'pre_term_description',
     3111        'pre_link_description',
     3112        'pre_link_notes',
     3113        'pre_user_description',
     3114    );
     3115
     3116    foreach ( $filters as $filter ) {
     3117        add_filter( $filter, 'wp_targeted_link_rel' );
     3118    };
     3119}
     3120
     3121/**
     3122 * Removes all filters modifying the rel attribute of targeted links.
     3123 *
     3124 * @since 5.1.0
     3125 */
     3126function wp_remove_targeted_link_rel_filters() {
     3127    $filters = array(
     3128        'title_save_pre',
     3129        'content_save_pre',
     3130        'excerpt_save_pre',
     3131        'content_filtered_save_pre',
     3132        'pre_comment_content',
     3133        'pre_term_description',
     3134        'pre_link_description',
     3135        'pre_link_notes',
     3136        'pre_user_description',
     3137    );
     3138
     3139    foreach ( $filters as $filter ) {
     3140        remove_filter( $filter, 'wp_targeted_link_rel' );
     3141    };
     3142}
     3143
     3144/**
    30993145 * Convert one smiley code to the icon graphic file equivalent.
    31003146 *
Note: See TracChangeset for help on using the changeset viewer.