WordPress.org

Ready to get started?Download WordPress

Forums

wp_insert_post creating post with title '(no title)'? (2 posts)

  1. Jeff Farthing
    Member
    Posted 5 years ago #

    While using the following code, the post shows up in the admin as (no title). Hoever, as you can see, I am specifying the title and it is showing in the edit screen. So, what's going on?

    ` $my_plugin = get_page_by_title('My Plugin');
    if (!$my_plugin) {
    $insert = array(
    'post_title' => 'My Plugin',
    'post_status' => 'publish',
    'post_type' => 'page',
    'post_author' => 1,
    'post_content' => '[my-plugin]',
    'comment_status' => 'closed',
    'ping_status' => 'closed'
    );

    $my_plugin = wp_insert_post($insert);
    } else $my_plugin = $my_plugin->ID;

  2. Jeff Farthing
    Member
    Posted 5 years ago #

    bump.

Topic Closed

This topic has been closed to new replies.

About this Topic