wp_insert_post blocks php script execution
-
Hello everyone, I’m developing a plugin that calls wp_insert_post(), but the plugin execution is locked in the call to wp_insert_post().
This is the snippet of code I’m running:
$new_page = array(
'post_type' => 'post',
'post_title' => 'Test Page Title',
'post_content' => 'Test Page Content',
'post_status' => 'draft',
'post_author' => get_current_user_id(),
);
echo "PUBLISHING 2.....<br>";
try {
$new_page_id = wp_insert_post($new_page, true, false);
echo "PUBLISHING 3: id=$new_page_id.....<br>";
} catch (Exception $ex) {
echo "EXCEPTION..... $ex<br>";
}This is the output:
PUBLISHING 1.....
PUBLISHING 2.....The post is published, as I see it in post list, but the execution is stopped, without giving any feedback from the function and without throwing any exception.
Anyone knows how to fix it?
I’m available for providing futher info. I’m running it on a local WordPress installation.
Thanks in advance
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.