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?
- Return HTML Template Page with PHP Function
- Getting the comment number relative to all the post’s comments
- lazy load comments wordpress on click
- Use Filename for Alt and Title Tags
- Trying to use Ternary operators with WP Conditionals
- Filter link to existing content suggestion
- How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context
- Generate an array of parent/child page IDs, based on parent page name
- fallback image for featured image
- Add attribute / custom attribute to product in woocommerce
- wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09
- How to create another version of my site based on the same database
- Why is this Ajax not working?
- Stumped on migration
- Count the number of times the search form template gets included on a page
- Using $_GET in Functions.php [closed]
- Adding nofollow to a PHP generated Nav
- How to show part of the_content?
- WordPress plugin/code to hide all things related of a user from the public
- Call a PHP Function with Multiple Parameters that is outside the AJAX Handler
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- “imagejpeg” function is not working in wordpress
- edit search.php to include subdomain posts
- Remove echo from shortcode
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- Category title output before opening title tag
- unable to use ‘new WP_Query’ in AJAX call
- admin-ajax Firing Error 400 When Logged In
- Jquery window.send_to_editor function
- PHP: Showing currency sign if input is a number
- Automatic excerpt is not shown with the_excerpt() command
- Multiple requests external data api dynamic block gutenberg
- Woocommerce with Lazy Load php and ajax
- How to check $_GET isset for a parameter and value? [closed]
- Get post categories
- Handling PHP/HTML inside the output of a shortcode function
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Update post meta – Custom field does not match meta-key
- Need help removing […] after excerpt
- How to replace URL protocol using PHP?
- WPDB secure custom form
- setcookies and header send
- Disable category RSS Feeds on WordPress blog with PHP
- Insert content into head tag with function
- Pagination in single.php
- Why wp_remote_get() fetches certain web pages while it doesn’t work for my localhost?
- Getting text from custom field from customizer
- Adding wp users ID into a link address from a DIVI modul
- Execute function only for specific user roles
- Create plugin with custom page and template caused an error `Call to undefined function get_header()`
- WordPress redirects to localhost
- Pass a PHP function to javascript
- Include User ID in iFrame URL
- Variant Item SKU as Product Code
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- static page pagination not working
- Add a new view on the Woocommerce account page
- How to change the value of a variable using input field?
- Collect all events in one year
- Show the subcategory name based on current product
- Getting an empty space in up sell items
- Remove node from multisites?
- Vertical Menu for one page only
- Display a single row from nested array of custom field data
- Where is the php file of single member profile view (BuddyPress)
- global $post inside plugin query messes up every new post page in wp-admin
- Create a custom theme-specific page, invisible in the admin-panel?
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- wp nav menu without label
- Magento and WordPress URL integration [closed]
- !in_array doesnt recognize category
- WXR XML import is stripping php tags that I need to keep
- unable to set uploaded file via frontend form as featured image
- Metadata on the WP_Post object
- How to customize posts in WordPress by using HTML and CSS?
- paginate_links() returns NULL instead of the pagination links, but pagination is actually happening
- is it possible to create cart functionality without woocommerce? [closed]
- Add multiple HTML attributes to an Elementor button
- Customize the summary table of an order in the email
- How to sort custom sortable column by custom table value