wp_insert_post issue

When inserting a new post, you must omit or leave the ID parameter empty, or the post will not be inserted. You can only set the ID if you are updating an existing post with that ID. See wp_insert_post in Codex for more information.

Could not get post ID from wp_insert_post()

Apparently there is nothing wrong with my script above. There is actually a conflict with another plugin which called the same 3rd party script twice via add_action( ‘save_post’, ‘function_name’). This double fired the 3rd party script and caused error when my script above try to do insert post. I have turned on debug at wp-config.php … Read more

after wp_insert_post need to get the post id

$post_ID = wp_insert_post($post); … should work, as you mentioned. From the Codex: Returns the ID of the post if the post is successfully added to the database. On failure, it returns 0 if $wp_error is set to false, or a WP_Error object if $wp_error is set to true.

wp_insert_post -> post_content not showing

OK, SO this is what I found out, the data <object>…</object> was the culprit. WordPress sanitizes the input before committing to the database. Other non allowed tags include <embed>…</embed> I’ve seen this solution online $postData = array( … ‘filter’=>true … ); However, some people say that’s a security flaw. I dug a little deeper and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)