Why iframe or script tags are not showing?

If you added an iframe or script tags into a page on your website and it was working while you are logged in into your WordPress account but they are not showing in the live site when you are not logged in into WordPress, this means that there is a filter defined in the text editor that you are using (for example Elementor HTML code block) and it doesn’t allow the iframe or script tags, in order to solve the issue and enable them you can add this code snippet into the functions.php file in your child theme:

function custom_wpkses_post_tags( $tags, $context ) {
	if ( 'post' === $context ) {
		$tags['iframe'] = array(
			'src'             => true,
			'height'          => true,
			'width'           => true,
			'frameborder'     => true,
			'allowfullscreen' => true,
			'id' => true,
			'scrolling' => true,
		);
		$tags['script'] = array(
			'src'             => true,
		);
	}
	return $tags;
}
add_filter( 'wp_kses_allowed_html', 'custom_wpkses_post_tags', 10, 2 );
pixfort
pixfort
Essentials support team
hub.pixfort.com

Hey, this is pixfort support team, if you still need help you can always reach us via the chat messenger in your account on pixfort hub

Related Posts