Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. register_activation_hook( __FILE__, 'insert_page' );
  2.  
  3. function insert_page(){
  4. // Create post object
  5. $my_post = array(
  6. 'post_title' => 'Menu',
  7. 'post_content' => 'Short Code',
  8. 'post_status' => 'publish',
  9. 'post_author' => get_current_user_id(),
  10. 'post_type' => 'page',
  11. );
  12.  
  13. // Insert the post into the database
  14. wp_insert_post( $my_post, '' );
  15. $newvalue = wp_insert_post( $post, false );
  16. update_option( 'Menu', $newvalue );
  17. }
  18. register_deactivation_hook( __FILE__, 'deactivate_plugin' );
  19.  
  20. function deactivate_plugin() {
  21.  
  22. $page = get_page_by_title('Menu');
  23. wp_delete_post($page);
  24.  
  25. }
Add Comment
Please, Sign In to add comment