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
824            * HTML tags and attribute names are case-insensitive in HTML but must be
825            * added to the KSES allow list in lowercase. An item added to the allow list
826            * in upper or mixed case will not recognized as permitted by KSES.
827            *
828            * @since 3.5.0
829            *
830            * @param array[] $html    Allowed HTML tags.
831            * @param string  $context Context name.
832            */
833           return apply_filters( 'wp_kses_allowed_html', $html, $context );
834      }
835
836      switch ( $context ) {
837           case 'post':
838                /** This filter is documented in wp-includes/kses.php */
839                $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
840
841                // 5.0.1 removed the `<form>` tag, allow it if a filter is allowing it's sub-elements `<input>` or `<select>`.
842                if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) {
843                     $tags = $allowedposttags;
844
845                     $tags['form'] = array(
846                          'action'         => true,
847                          'accept'         => true,
848                          'accept-charset' => true,
849                          'enctype'        => true,
850                          'method'         => true,
851                          'name'           => true,
852                          'target'         => true,
853                     );
854
855                     /** This filter is documented in wp-includes/kses.php */
856                     $tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
857                }
858
859                return $tags;
860
861           case 'user_description':
862           case 'pre_user_description':
863                $tags             = $allowedtags;
864                $tags['a']['rel'] = true;
865                /** This filter is documented in wp-includes/kses.php */
866                return apply_filters( 'wp_kses_allowed_html', $tags, $context );
867
868           case 'strip':
869                /** This filter is documented in wp-includes/kses.php */
870                return apply_filters( 'wp_kses_allowed_html', array(), $context );
871
872           case 'entities':
873                /** This filter is documented in wp-includes/kses.php */
874                return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
875
876           case 'data':
877           default:
878                /** This filter is documented in wp-includes/kses.php */
879                return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
880      }
881 }
882
883 /**
884  * You add any KSES hooks here.
885  *
886  * There is currently only one KSES WordPress hook, {@see 'pre_kses'}, and it is called here.
887  * All parameters are passed to the hooks and expected to receive a string.
888  *