• Resolved pipoulito

    (@pipoulito)


    Hi,
    please how can i add an embed code from YOUTUBE (<iframe…) .
    My code is removed when i saved the page.
    thanks

    • This topic was modified 7 years, 3 months ago by pipoulito.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @pipoulito,

    By default, that textarea does not accept iframes. But you can use the built-in hooks to change this behavior.

    Place the next snippet at the end of the functions.php file (located inside your active theme/child-theme directory).

    
    /**
     * Add iframe to allowed html tags
     *
     * @param string $tags
     * @param string $context
     *
     * @return array
     */
    function wpmm_allow_iframes($tags, $context) {
    	if ($context === 'post') {
    		$tags['iframe'] = array(
    			'src' => true,
    			'height' => true,
    			'width' => true,
    			'frameborder' => true,
    			'allow' => true,
    			'allowfullscreen' => true,
    		);
    	}
    
    	return $tags;
    }
    
    add_filter('wp_kses_allowed_html', 'wpmm_allow_iframes', 10, 2);
    

    Disclaimer: If there is a PHP closing tag (?>) at the of the file, make sure you add the snippet before it.


    George

    • This reply was modified 7 years, 3 months ago by George J.
    Thread Starter pipoulito

    (@pipoulito)

    Thanks it works fine, can my video be full screen ?
    thanks

    @pipoulito The fullscreen button of the embed should work fine. But if you want to use the video as a page background (or anything like this), you can change the HTML of the maintenance mode page by following these steps:

    – download maintenance.php from /wp-content/plugins/wp-maintenance-mode/views/ directory;
    – rename the file to wp-maintenance-mode.php and change it however you need;
    – upload the file to /wp-content/ directory.

    • This reply was modified 7 years, 3 months ago by George J.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Embed youtube’ is closed to new replies.