wp_insert_post not working fine

Question

I asked my question on stackoverflow but I did not get any answer, may be because it’s the question related to WordPress.So I am asking it here.

I am using wp_insert_post function to insert my posts, but it is not working fine for me.

Here is my post_content

$content = '<div class="snippet">
   <strong>Wordpress Tutorial - Jetpack Plugin installieren &amp; konfigurieren</strong>
   <br/>
   <p>Wordpress Online Kurs unter http://wordpress-online-kurs.de Sie erhalten Tutorials zu den WordPress Themen, wie Plugins, Theme, SEO ...<a href=https://www.google.com/url?rct=j&sa=t&url=http://www.youtube.com/watch%3Fv%3DzjMtxin-hRA&ct=ga&cd=CAIyGmExYThkZTljMmU3MDQyZGE6Y29tOmVuOlVT&usg=AFQjCNGFOBEtFiT4f7zq6xl-xTbsW9uIVg target="_blank"></a>
   <br />
   <a href=https://www.google.com/url?rct=j&sa=t&url=http://www.youtube.com/watch%3Fv%3DzjMtxin-hRA&ct=ga&cd=CAIyGmExYThkZTljMmU3MDQyZGE6Y29tOmVuOlVT&usg=AFQjCNGFOBEtFiT4f7zq6xl-xTbsW9uIVg rel="nofollow" target='_blank'>See Original Article </a>
   </p>
</div>
<div class="snippet">
   <strong>Preview Fargo - Responsive Creative WordPress Theme TFx</strong>
   <br/>
   <p>
      Preview and Download : http://fxtheme.com/themes/fargo-responsive-creative-wordpress-theme-tfx FARGO is a beautifully designed and visually ...<a href=https://www.google.com/url?rct=j&sa=t&url=http://www.youtube.com/watch%3Fv%3DqjKCijxQR1M&ct=ga&cd=CAIyGmExYThkZTljMmU3MDQyZGE6Y29tOmVuOlVT&usg=AFQjCNGlUblc7rKI0OjRLqe1CChEfbpYmQ target="_blank"></a>
   <br />
   <a href=https://www.google.com/url?rct=j&sa=t&url=http://www.youtube.com/watch%3Fv%3DqjKCijxQR1M&ct=ga&cd=CAIyGmExYThkZTljMmU3MDQyZGE6Y29tOmVuOlVT&usg=AFQjCNGlUblc7rKI0OjRLqe1CChEfbpYmQ rel="nofollow" target='_blank'>See Original Article </a>
   </p>
</div>';

When I am adding this as manually it is inserting while I am using cron to insert it just insert post up to “SEO”

Code is :

$my_post = array('post_title'=>'test post','post_content'=>$content);

Any suggestions to solve this?

0
, Bhuvnesh Gupta 2 years 2020-01-02T08:38:39-05:00 0 Answers 97 views 0

Leave an answer

Browse
Browse