Function wp_insert_post doesn’t work on pages?
-
I am having issues with the usage of wp_insert_post (); to insert WordPress Pages.
The below code:
$my_post = array(); $my_post['post_title'] = 'Search'; $my_post['post_status'] = 'publish'; $my_post['post_type'] = 'page'; $success = wp_insert_post ($my_post);
Generates the below errors:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in [...]/wp-includes/post.php on line 1448 Fatal error: Call to a member function get_page_permastruct() on a non-object in [...]/wp-includes/link-template.php on line 217
To make your life easier, here is the online source code of post.php and link_template.php.
Can anybody help me?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Function wp_insert_post doesn’t work on pages?’ is closed to new replies.