WordPress.org

Ready to get started?Download WordPress

Forums

Problem with wp_insert_post page (2 posts)

  1. idovecer
    Member
    Posted 3 years ago #

    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 );

  2. idovecer
    Member
    Posted 3 years ago #

    Sorry, maybe someone knows the answer?
    Did I post it in correct forum?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.