Skip to main content
2 of 3
added 154 characters in body
chi11ax
  • 141
  • 5

wp_insert_post -> post_content not showing

I have a problem with wp_insert_post.

When I'm attempting to insert my post, the post_content essentially shows up as just blanks spaces. I even went into MySQL to confirm. Everything else, post_title, post_excerpt, etc shows up just fine.

I did a print_r($this->jsonData['data']) Just prior to passing this to wp_insert_post just to be sure it wasn't empty and the right data was present.

The contents of the data are

<object> ... </object> 

Would that be an issue?

Here's my code that creates the $this->postData variable that's passed into wp_insert_post.

$this->postData = array(
        'post_content' => $this->jsonData['data'],
        'post_title' => $this->jsonData['title'],
        'post_excerpt' => $this->jsonData['description'],
        'tags_input' => $this->jsonData['tags'],
        'post_date' => date('Y-m-d H:i:s'),
        'post_status' => 'publish',
        'post_author' => 1,
        'post_date_gmt' => date('Y-m-d H:i:s'),
    );

thanks in advance!

chi11ax
  • 141
  • 5