Reputation: 1523
On the register_activation_hook of my plugin I am adding a post with the following code.
$details_page = array(
'post_title' => 'details',
'post_content' => '[auto]',
'post_type' => 'page',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 3,4 )
);
wp_insert_post($details_page);
It adds the post with the right shortcode in it. But now I want to delete the word "Details" on the page. (the post title).
I don't know how to do this. I thought of getting the post by name in the registration hook and then delete the Title. But I don't know how.
Upvotes: 2
Views: 338
Reputation: 1523
Found the solution..
$details_page = array(
'post_title' => '',
'post_name' => 'details',
'post_content' => '[auto]',
'post_type' => 'page',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 3,4 )
);
wp_insert_post($details_page);
the post_title could be empty if you use post_name instead
Upvotes: 1