Unicode characters are saved in a funny way in the DB
Do not touch that string. URLs must be percent-encoded, and what you see is the slug for the URL. A browser will display the characters just fine, so don’t worry about the database.
Do not touch that string. URLs must be percent-encoded, and what you see is the slug for the URL. A browser will display the characters just fine, so don’t worry about the database.
You are using the wrong function. wp_insert_post() is for creating posts. You need wp_update_post() if you want to update existing data.
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
$row doesn’t look like you think it does. $wpdb->get_results will by default return an array of objects. Your code– ‘post_title’ => $row[‘Title’]— treats an object like an array and should generate a Fatal Error, which you’d see if you had debugging enabled. Fatal error: Cannot use object of type stdClass as array in … You … Read more
You use add_action! Like this: function save_id_to_file($post_id){ //use your file creation/save function here return $post_id; } add_action(‘wp_insert_post’,’save_id_to_file’);
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
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
The nonce field is not added to the form, and is therefore not passed in the POST request when submitting the form. Thus, isset( $_POST[‘post_nonce_field’] ) returns false and the conditional is never true. Try moving the nonce field to someplace between the opening form tag ( <form>) and closing form tag (</form>). EDIT: The … Read more
The error message basically says that $wpdb is not an object so you can’t call any methods on it. As we can’t see where $wpdb is defined in the source you posted it’s hard to tell any further details. Are you even including wordpress in your external file? You need to require wp-load.php to use … Read more
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”