[wp-trac] [WordPress Trac] #30464: kses_allowed_protocols filter not working

WordPress Trac noreply at wordpress.org
Tue Feb 27 18:46:52 UTC 2024


#30464: kses_allowed_protocols filter not working
--------------------------+-------------------------
 Reporter:  hatul         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.0.1
 Severity:  normal        |  Resolution:  worksforme
 Keywords:  close         |     Focuses:
--------------------------+-------------------------

Comment (by yaslanarkana):

 Filters the list of protocols allowed in HTML attributes.

 To use kses_allowed_protocols filter, first you have to register it using
 add_filter. You can write this code into functions.php of your activated
 theme or in a custom WordPress Plugin.

 We at Flipper Code, always prefer to create a custom WordPress Plugin
 while using hooks so nothing breaks when you update your WordPress Theme
 in the future.

 In the below live example, we have defined a function
 modify_kses_allowed_protocols_defaults which takes 1 parameters and we
 registered using add_filter. The first parameter kses_allowed_protocols is
 name of the hook, The second parameter
 modify_kses_allowed_protocols_defaults is name of the function which need
 to be called, third parameter is the priority of calling the hook if same
 hook is used multiple times and the last parameter is the number of
 arguments (if any) to be passed in the registered function.

 Sometime, you have to remove a registered hook so you can use
 remove_filter to remove kses_allowed_protocols filter.

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


More information about the wp-trac mailing list