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
Support Team

Hey, this is pixfort support team, if you still need help you can always reach us via your pixfort account

Related Posts

Search

Start typing to search for a specific article on our website

Made with Popup Builder
Image link
Hey there

Search for a specific article

Get started

Check useful guides to get started

Still need Help?

Send us a support message

Our usual reply time: 1 Business day