There are no signs that this was accidental or a bug, and has been in core for many years. This is because of this set of lines at the end of the main loop of safecss_filter_attr:
// Only add the CSS part if it passes the regex check.
if ( $allow_css ) {
if ( '' !== $css ) {
$css .= ';';
}
$css .= $css_item;
}
The root of the question is a broken assumption that wp_kses modifies the original HTML string, which is not the case.
Instead, wp_kses uses regular expressions to break apart your HTML into arrays which are then further subdivided by more regular expressions. It’s these arrays that are then going to be processed to remove attributes and tags etc. Then these are reassembled to create a brand new HTML string.
Related Posts:
- How to check if a string is a valid URL
- What is the best practice for escaping data URIs?
- Shortcode putting html such as
- Proper use of internationalization
- Validate Uploaded Image using WordPress’ Built-in Functions?
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- wp_kses and magic quotes
- How to remove role=”navigation” from all nav elements?
- What esc_ to use to validate this?
- Sanitizing text fields in array
- register_setting & add_settings_error validation issues with multiple fields
- Broken kses.php function “wp_kses_named_entities” crashes WordPress
- WordPressUser Submission Form
- Contact form – problem with displaying message about sent mail
- Contact Form 7 WordPress, checking a few fields, if empty then invalid
- Custom HTML form using PHP – help with ajax/username validation
- WP Debug enabled Undefined index error in a widget
- Custom Registration and Login Forms with reCaptcha 2 Validation
- oneOf JSON Schema validation not properly working for custom post meta value?
- Does it make sense to sanitize the output of an SVG file?
- How to find cause of PHP notices with no stack trace?
- The correct method to pass query vars in AJAX using ajaxurl
- How to paginate a list of custom taxonomy terms?
- Display user’s total comment count outside The Loop
- Getting the action’s tag name within the action
- wordpress separate registration for different roles
- How to get user by display_name with WP_User_Query
- Changing Link Attributes for Wp_Link_Pages
- Problem with Woocommerce REST API Authentication
- How to get custom image size for image uploaded in Customizer
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to change
- Get only the grandchildren, not the direct children of page/current page?
- Passing POST data from one WP post to another
- Use wp_remote_get to get JSON instagram feed from public profile
- How to add SVG icon above product tab title
- Call to undefined function issue
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How can I generate random numbers inside my shortcodes on each implementation?
- custom widget on the footer
- How to create a custom category of wordpress admin
- WordPress automatically adding html tag around PHP code
- Customizer: Output default value in Customizer CSS
- Converting HTML Template to WordPress Theme
- How to hide all child pages with post_query?
- PHP Warning: chmod(): Operation not permitted in class-wp-filesystem-direct.php on line 173
- Saving an array of dynamic repeater data as post_meta
- How can I apply_filters from inside a function?
- Image rotation and editing stopped working in WordPress after upgrading Ubuntu from 16.04 to 18.04
- WordPress asks you for your FTP details if you want to run Automatic Updates/Upgrade Plugins
- Populate editor with some content of a page with a page template
- Where is wp() function definition?
- WordPress add_rewrite_rules for custom URLs ending in .html
- Make Current/Active Page Number a Link (WP_LINK_PAGES)
- How to show number of unpublished articles?
- How to make modifications only to certain elements of an HTML string on the server-side?
- How to retrieve the data from the sever and displaying it in a page?
- Javascript not loading on certain page
- WordPress get_media_embedded
- Add editor toolbar to Metabox
- Display WordPress Post on A Different Site
- Add row to custom database Table and delete all rows older than 1 day
- How to get all the items of a taxonomy even if it does not have a custom post type?
- Displaying Overlay images over thumbnail of category type?
- PHP: $_SESSION destroyed after page reload for my custom session
- Wp Query : Order by distance lat,lon
- Hide publish date when update date
- How can I check if a post with a particular slug or title exists?
- Category Page Displaying all Pages
- problem connecting to the administrator
- How do I integrate vanilla Javascript to a wordpress website?
- Looping through dummy posts and showing them in the main index.php
- Force Sidebar on Full Width page
- Exclude category from function – PHP
- ACF – Can’t get custom post type by taxonomy
- Update user meta when an external link in admin notice is clicked
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- How to count posts posts if they are in a separate content page?
- Ajax in a class instantiated via shortcode
- PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions
- Shortcode Works for Logged in Users but Not Working for Guest
- Fix mod_pagespeed Fetch timed out error on bitnami AWS wordpress installation
- Adding my own custom template page but got white page
- How to set max users to 17.000
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- Adding javascript files to WordPress and jQuery version
- Display default WordPress login/registration form into a modal window
- How do I use CSS or PHP to customize WordPress Form Manager Plugin Table?
- WP Login Button for current domain
- Pull GET parameter from URL in functions.php
- How to NOT override inline css rules
- Twig+WordPress how to use array arguments inside a function?
- how to indicate on post listing title if user already liked this post
- wordpress – page not loading (404) even if it’s there
- Run a WordPress blog (subdirectory) in a Laravel WebApp – SEO Concerns
- How to add query string at the end of sitemap Yoast SEO
- Options for using custom PHP in a wordpress site? No FTP access
- How to return count number from a wordpress database
- Function extension