Programmatically add posts from api.
-
Hi,
We have a 3rd party API. The entries of the API needs to be imported into a custom posttype.
The unfortunate thing is that I’m having some trouble with this.Currently I am using this code:
$post = array( 'post_author' => 2, 'post_content' => "{$xml->opmerkingen}", 'post_name' => "{$xml->titel}", 'post_status' => 'publish', 'post_excerpt' => "{$xml->opmerkingen}", 'post_title' => "{$xml->titel}", 'post_type' => 'voertuig' ); wp_insert_post($post);
And it is giving me these erros.
Notice: Trying to get property of non-object in wp-includes/post.php on line 3578
Notice: Trying to get property of non-object in wp-includes/link-template.php on line 49
Fatal error: Call to undefined function is_user_logged_in() in wp-includes/post.php on line 2066
I hope somebody could help me out with this!
Thanks in advance,
Sem
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Programmatically add posts from api.’ is closed to new replies.