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