2017-05-29 1 views

Antwort

2

Sie müssen WordPress Plug-in Aktivierung Hook verwenden, um neue Seite namens "register_activation_hook" hinzufügen. es ruft, wenn dein Plugin aktiviert ist.

register_activation_hook(__FILE__, 'insert_page'); 

function insert_page(){ 
    // Create post object 
    $pageArray = array(
     'post_title' => 'My Page', 
     'post_content' => 'This is my page.', 
     'post_status' => 'publish', 
     'post_author' => get_current_user_id(), 
     'post_type'  => 'page', 
    ); 

    // Insert the post into the database 
    wp_insert_post($pageArray, ''); 
} 
Verwandte Themen