#30464 closed defect (bug) (worksforme)
kses_allowed_protocols filter not working
Reported by: | hatul | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0.1 |
Component: | General | Keywords: | close |
Focuses: | Cc: |
Description
I try add filter to allowed protocols but its not working.
My code:
function wpse_allow_sms_protocol( $protocols ) { $protocols = array('sms'); return $protocols; } add_filter( 'kses_allowed_protocols', 'wpse_allow_sms_protocol' ); print_r(wp_allowed_protocols());
print:
Array ( [0] => http [1] => https [2] => ftp [3] => ftps [4] => mailto [5] => news [6] => irc [7] => gopher [8] => nntp [9] => feed [10] => telnet [11] => mms [12] => rtsp [13] => svn [14] => tel [15] => fax [16] => xmpp )
I found this problem in forum too without answer.
Change History (6)
#2
@
10 years ago
- Resolution set to worksforme
- Status changed from new to closed
For reference, the 'kses_allowed_protocols' filter runs before the 'init' action. Try using the 'plugins_loaded' action, or just hook the filter at the top of your plugin.
#4
@
10 years ago
- Keywords close added
thanks. if I run its in plugins_loaded the code is working.
function wpse_allow_sms_protocol( $protocols ) { $protocols = array('sms'); return $protocols; } add_action('plugins_loaded', function(){add_filter('kses_allowed_protocols', 'wpse_allow_sms_protocol' );}); print_r(wp_allowed_protocols());
#5
@
10 years ago
- Resolution worksforme deleted
- Status changed from closed to reopened
I wrong. My code still not working.
I get:
Array ( [0] => http [1] => https [2] => ftp [3] => ftps [4] => mailto [5] => news [6] => irc [7] => gopher [8] => nntp [9] => feed [10] => telnet [11] => mms [12] => rtsp [13] => svn [14] => tel [15] => fax [16] => xmpp )
Note: See
TracTickets for help on using
tickets.
You are probably trying to hook the filter after the filter runs. Make sure you are adding filters during initialization.