Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_kses_allowed_html

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 7 times in this file.

Line Code
858            * HTML tags and attribute names are case-insensitive in HTML but must be
859            * added to the KSES allow list in lowercase. An item added to the allow list
860            * in upper or mixed case will not recognized as permitted by KSES.
861            *
862            * @since 3.5.0
863            *
864            * @param array[] $html    Allowed HTML tags.
865            * @param string  $context Context name.
866            */
867           return apply_filters( 'wp_kses_allowed_html', $html, $context );
868      }
869
870      switch ( $context ) {
871           case 'post':
872                /** This filter is documented in wp-includes/kses.php */
873                $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
874
875                // 5.0.1 removed the `<form>` tag, allow it if a filter is allowing it's sub-elements `<input>` or `<select>`.
876                if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) {
877                     $tags = $allowedposttags;
878
879                     $tags['form'] = array(
880                          'action'         => true,
881                          'accept'         => true,
882                          'accept-charset' => true,
883                          'enctype'        => true,
884                          'method'         => true,
885                          'name'           => true,
886                          'target'         => true,
887                     );
888
889                     /** This filter is documented in wp-includes/kses.php */
890                     $tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
891                }
892
893                return $tags;
894
895           case 'user_description':
896           case 'pre_user_description':
897                $tags             = $allowedtags;
898                $tags['a']['rel'] = true;
899                /** This filter is documented in wp-includes/kses.php */
900                return apply_filters( 'wp_kses_allowed_html', $tags, $context );
901
902           case 'strip':
903                /** This filter is documented in wp-includes/kses.php */
904                return apply_filters( 'wp_kses_allowed_html', array(), $context );
905
906           case 'entities':
907                /** This filter is documented in wp-includes/kses.php */
908                return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
909
910           case 'data':
911           default:
912                /** This filter is documented in wp-includes/kses.php */
913                return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
914      }
915 }
916
917 /**
918  * You add any KSES hooks here.
919  *
920  * There is currently only one KSES WordPress hook, {@see 'pre_kses'}, and it is called here.
921  * All parameters are passed to the hooks and expected to receive a string.
922  *