Inserting current user ID into Post for Author

You need to use the global variable for the user ID (if you actually need to use it) somewhat like this: global $user_ID; get_currentuserinfo(); The get_currentuserinfo() call will populate the global $user_ID variable which you can then use directly, as you have it in your args currently. Reference

post_categories array using variable

There’s an example here: http://codex.wordpress.org/Function_Reference/wp_insert_post // Create post object $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_category’ => array(8,39) ); // Insert the post into the database wp_insert_post( $my_post ); ‘post_category’ takes an array so you’d want to send it one. In your … Read more

wp_insert_post Only creates draft

The reason why your code created drafts only is status=”pending” make it publish Like // Prepare to save! do_action( ‘wpo_frontend_before_save_order’, $order_details, $user_details ); $post = array( ‘post_title’ => $order_details[‘title’], ‘post_author’ => get_current_user_id(), ‘post_type’ => ‘wp_order’, ‘post_status’ => ‘publish’ ); $postID = wp_insert_post( $post ); if ( is_wp_error( $postID ) ) { set_transient( ‘wpo_new_order_message_’ . get_current_user_id(), … Read more

wp_insert_post not working fine

As Joshua suggested in his comment, your code isn’t escaped properly. Just before “See Original Article” (in both snippets) you have target=”_blank” on your links with single quotes. Replace that with double quotes target=”_blank”

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