• 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.

    P.S.
    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 );

  • The topic ‘Problem with page wp_insert_posts’ is closed to new replies.