Support » Fixing WordPress » Problem with wp_insert_post page

  • Hi.

    I do have problem with wp_insert_post when try to insert post_type as “page”.

    Everything works fine for post_type as “post”, but for page I get this error:

    Fatal error: Call to a member function get_page_permastruct() on a non-object in \wp-includes\link-template.php on line 274

    Thanks for any help and suggestions.

    Here is simple example, doens’t work for page, but it’s working for post as post_type.

    $my_post = array(
    ‘post_title’ => ‘Test title’,
    ‘post_content’=> ‘Test content’,
    ‘post_status’ => ‘publish’,
    ‘post_type’ => ‘page’,
    ‘post_author’ => 1

    wp_update_post ( $my_post, $wp_error );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with wp_insert_post page’ is closed to new replies.