[wp-trac] [WordPress Trac] #55962: Upgrade `sanitize_hex_color()` to CSS Color Level 4

WordPress Trac noreply at wordpress.org
Sun Jun 12 14:27:14 UTC 2022


#55962: Upgrade `sanitize_hex_color()` to CSS Color Level 4
-------------------------------------------------+-------------------------
 Reporter:  anrghg                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Formatting                           |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests dev-    |     Focuses:  css
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by ocean90):

 One of the benefits of all the `sanitize_*` functions is that you can
 easily use them as a sanitize callback when registering options, metas, or
 REST API fields. As soon as there's an argument you have to work with
 something like a closure to set the argument and ensure no other value is
 passed to the function as the second argument.

 So maybe both?

 Also note that the REST API supports `hex-color` as a format for type
 `string`, see `rest_sanitize_value_from_schema()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55962#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list