Make WordPress Core

Changeset 52895


Ignore:
Timestamp:
03/10/2022 11:25:10 PM (2 years ago)
Author:
jorgefilipecosta
Message:

Block Editor: Improve Global Styles filtering order.

From the conceptual point it makes sense to execute global styles filters before post filters. So the post filters are always the last.

Props xknown, sergey, audrasjb, vortfu, oandregal, get_dave.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r52693 r52895  
    22022202    }
    22032203
     2204    // Global Styles filtering: Global Styles filters should be executed before normal post_kses HTML filters.
     2205    add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
     2206    add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
     2207
    22042208    // Post filtering.
    22052209    add_filter( 'content_save_pre', 'wp_filter_post_kses' );
    2206     add_filter( 'content_save_pre', 'wp_filter_global_styles_post' );
    22072210    add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
    22082211    add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
    2209     add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post' );
    22102212}
    22112213
     
    22302232    remove_filter( 'pre_comment_content', 'wp_filter_kses' );
    22312233
     2234    // Global Styles filtering.
     2235    remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
     2236    remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
     2237
    22322238    // Post filtering.
    22332239    remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
    2234     remove_filter( 'content_save_pre', 'wp_filter_global_styles_post' );
    22352240    remove_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
    22362241    remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
    2237     remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post' );
    22382242}
    22392243
Note: See TracChangeset for help on using the changeset viewer.