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