Код: Выделить всё
Я попробовал добавить приведенный ниже код. в functions.php, но он все равно был удален.
Код: Выделить всё
function allow_lottie_tags($tags, $context) {
// Add for all contexts
$allowed_atts = array(
'src' => true,
'background' => true,
'speed' => true,
'loop' => true,
'autoplay' => true,
'class' => true,
'id' => true,
'style' => true
);
// Apply to both default and 'post' context
if ($context === 'post' || $context === 'default') {
$tags['dotlottie-player'] = $allowed_atts;
}
return $tags;
}
// Apply to multiple filters to catch different contexts
add_filter('wp_kses_allowed_html', 'allow_lottie_tags', 999, 2);
add_filter('post_allowed_html', 'allow_lottie_tags', 999, 2);
Код: Выделить всё
// Also try to force it globally
function hook_lottie_early() {
global $allowedposttags, $allowedtags;
$allowed_atts = array(
'src' => true,
'background' => true,
'speed' => true,
'loop' => true,
'autoplay' => true,
'class' => true,
'id' => true,
'style' => true
);
$allowedposttags['dotlottie-player'] = $allowed_atts;
$allowedtags['dotlottie-player'] = $allowed_atts;
}
add_action('init', 'hook_lottie_early', 1);
Подробнее здесь: https://stackoverflow.com/questions/792 ... er-element
Мобильная версия