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