wp_update_post
-
Hello,
I spent three hours already and cannot make it work. I am trying to update the post content using wp_update_post function, but it does not seem to work.
Here is my code
$data = array(
'ID' => $postID
,'post_content' => stripslashes($output)
,'post_category' => array($catID)
);
wp_update_post($data);
die(print_r($data)); //this one is for debugging, and nothing changes whether it is here or not
print_r outputs the following
Array ( [ID] => 982 [post_content] => Мероприятие: one more
Место проведения: hope it works
Описание: dfdf123
Начало в: 00:00:00
Дата: 2012-01-30
Конец в: 00:00:00
[post_category] => Array ( [0] => 26 ) ) 1
I checked the database, entry seems fine
--
-- Dumping data for tablewp_posts
—INSERT INTO
wp_posts
(ID
,post_author
,post_date
,post_date_gmt
,post_content
,post_title
,post_excerpt
,post_status
,comment_status
,ping_status
,post_password
,post_name
,to_ping
,pinged
,post_modified
,post_modified_gmt
,post_content_filtered
,post_parent
,guid
,menu_order
,post_type
,post_mime_type
,comment_count
) VALUES
(982, 1, ‘2012-01-30 14:16:29’, ‘2012-01-30 14:16:29’, ‘Мероприятие: one more
Место проведения: hope it works
Описание: dfdf123
Начало в: 00:00:00
Дата: 2012-01-30
Конец в: 00:00:00
‘, ‘one more’, ”, ‘published’, ‘open’, ‘open’, ”, ‘one-more’, ”, ”, ‘2012-01-30 14:25:09’, ‘2012-01-30 14:25:09’, ”, 0, ‘https://ruconnect.co.uk/982/one-more/’, 0, ‘post’, ”, 0);Btw, what is that number 1 doing in the end of print_r?..
Thank you very much in advance
- The topic ‘wp_update_post’ is closed to new replies.