* kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
* Copyright (C) 2002, 2003, 2005 Ulf Harnhammar
* This program is free software and open source software; you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* http://www.gnu.org/licenses/gpl.html
* [kses strips evil scripts!]
* Added wp_ prefix to avoid conflicts with existing kses users
* @copyright (C) 2002, 2003, 2005
* @author Ulf Harnhammar <http://advogato.org/person/metaur/>
* Specifies the default allowable HTML tags.
* Using `CUSTOM_TAGS` is not recommended and should be considered deprecated. The
* {@see 'wp_kses_allowed_html'} filter is more powerful and supplies context.
* When using this constant, make sure to set all of these globals to arrays:
* - `$allowedentitynames`
* - `$allowedxmlentitynames`
* @see wp_kses_allowed_html()
* @var array[]|false Array of default allowable HTML tags, or false to use the defaults.
if ( ! defined( 'CUSTOM_TAGS' ) ) {
define( 'CUSTOM_TAGS', false );
// Ensure that these variables are added to the global namespace
// (e.g. if using namespaces / autoload in the current PHP environment).
global $allowedposttags, $allowedtags, $allowedentitynames, $allowedxmlentitynames;
* KSES global for default allowable HTML tags.
* Can be overridden with the `CUSTOM_TAGS` constant.
* @var array[] $allowedposttags Array of default allowable HTML tags.
$allowedposttags = array(
'popovertargetaction' => true,
'value_callback' => '_wp_kses_allow_pdf_objects',
'values' => array( 'application/pdf' ),
// https://www.w3.org/TR/mathml-core/#global-attributes
// Except common attributes added by _wp_add_global_attributes.
$math_global_attributes = array(
'mathbackground' => true,
// Common attributes also defined by _wp_add_global_attributes.
// We do not want to add all those global attributes though.
$math_overunder_attributes = array(
$allowedposttags = array_merge(
// https://www.w3.org/TR/mathml-core/#the-top-level-math-element
// https://www.w3.org/TR/mathml-core/#token-elements
// https://www.w3.org/TR/mathml-core/#text-mtext
'mtext' => $math_global_attributes,
// https://www.w3.org/TR/mathml-core/#the-mi-element
// https://www.w3.org/TR/mathml-core/#number-mn
'mn' => $math_global_attributes,
// https://www.w3.org/TR/mathml-core/#operator-fence-separator-or-accent-mo
// https://www.w3.org/TR/mathml-core/#space-mspace
// https://www.w3.org/TR/mathml-core/#string-literal-ms
'ms' => $math_global_attributes,
// https://www.w3.org/TR/mathml-core/#general-layout-schemata
// https://www.w3.org/TR/mathml-core/#horizontally-group-sub-expressions-mrow
'mrow' => $math_global_attributes,
// https://www.w3.org/TR/mathml-core/#fractions-mfrac