Support » Plugins and Hacks » wp_insert_post creating post with title ‘(no title)’?

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_insert_post creating post with title ‘(no title)’?’ is closed to new replies.