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
832      if ( is_array( $context ) ) {
833           /**
834            * Filters the HTML that is allowed for a given context.
835            *
836            * @since 3.5.0
837            *
838            * @param array[]|string $context      Context to judge allowed tags by.
839            * @param string         $context_type Context name.
840            */
841           return apply_filters( 'wp_kses_allowed_html', $context, 'explicit' );
842      }
843
844      switch ( $context ) {
845           case 'post':
846                /** This filter is documented in wp-includes/kses.php */
847                $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
848
849                // 5.0.1 removed the `<form>` tag, allow it if a filter is allowing it's sub-elements `<input>` or `<select>`.
850                if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) {
851                     $tags = $allowedposttags;
852
853                     $tags['form'] = array(
854                          'action'         => true,
855                          'accept'         => true,
856                          'accept-charset' => true,
857                          'enctype'        => true,
858                          'method'         => true,
859                          'name'           => true,
860                          'target'         => true,
861                     );
862
863                     /** This filter is documented in wp-includes/kses.php */
864                     $tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
865                }
866
867                return $tags;
868
869           case 'user_description':
870           case 'pre_user_description':
871                $tags             = $allowedtags;
872                $tags['a']['rel'] = true;
873                /** This filter is documented in wp-includes/kses.php */
874                return apply_filters( 'wp_kses_allowed_html', $tags, $context );
875
876           case 'strip':
877                /** This filter is documented in wp-includes/kses.php */
878                return apply_filters( 'wp_kses_allowed_html', array(), $context );
879
880           case 'entities':
881                /** This filter is documented in wp-includes/kses.php */
882                return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
883
884           case 'data':
885           default:
886                /** This filter is documented in wp-includes/kses.php */
887                return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
888      }
889 }
890
891 /**
892  * You add any KSES hooks here.
893  *
894  * There is currently only one KSES WordPress hook, {@see 'pre_kses'}, and it is called here.
895  * All parameters are passed to the hooks and expected to receive a string.
896  *