want to stop stripping out from my post content

I have installed wordpress for my site.
I am trying to insert posts using function wp_insert_post() from my self-made script.

content of my post contains video-embed code of google.
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/-T9omX2XD2s?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-T9omX2XD2s?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

when I am running script to insert this content in my post, by my surprise this code got stripped out from post.

Read More

I have surfed the internet and wordpress forum, I found that It is a SECURITY feature of wordpress.

I want to remove this security feature from my own wordpress site. so what should I do to opt-out this stripping function? so that I can add above html code as a content of a post.

Please give me the function name which is stripping out this codes from my content, so I can stop it working.

My complete code.

<?php
require('./wp-blog-header.php');
$contactObject['postTitle'] = $_POST['post_title'];
$contactObject['videoCode'] = $_POST['videoCode'];
$contactObject['description'] = $_POST['description'];
$categoryIds = $_POST['categories'];

insertPosts($contactObjects,$categoryIds);

function insertPosts($contactObjects,$categoryIds)
{

        $videoCode = $contactObject['videoCode'];
        $videoEmbedCode = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/'.$videoCode.'?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$videoCode.'?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>';

        $content = '';
        if($contactObject['description'] != '')
        {
                $content .= '<p>'.$contactObject['description'].'</p></br>';
        }
        $content .= $videoEmbedCode;

        // Create post object
        $my_post = array(
                 'post_title' => $contactObject['postTitle'],
                 'post_content' => $content,
                 'post_status' => 'publish',
                 'post_author' => 1,
                 'post_category' => $categoryIds,

        );

        // Insert the post into the database
        $postId = wp_insert_post( $my_post );
}
?>

Related posts

Leave a Reply

1 comment

  1. I’m only guessing but it sounds like your insert method is tripping up on one of WordPress’s filter functions (e.g. wp_filter_kses). If you need a more exact answer, please update your question to include some of the code you’re using to insert the post content.