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