wp_insert_post iframe missing

In my install, I use one custom page. Here I put one text field and the fck editor. This is for the title and the content. I need to insert this into a page.

I use the following code

$my_post = array(
    'post_title'    = $_POST['title'],
    'post_content'  = $_POST['content'],
    'post_type'       = 'page',
    'post_status'   = 'publish',
    'post_author'   = 1,
    'menu_order'    = 10,
);

// Insert the post into the database
$post_ID = wp_insert_post( $my_post );  

In the content field, I insert the content with some iframe videos. The page inserted successfully, but the iframe tags are not updated. They are deleted while update or insert the content.

Topic iframe oembed videos content Wordpress

Category Web


remove_filter('content_save_pre', 'wp_filter_post_kses');
remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
 
$id = wp_insert_post( $my_post );
 
add_filter('content_save_pre', 'wp_filter_post_kses');
add_filter('content_filtered_save_pre', 'wp_filter_post_kses');

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.