• I’ve got this working for an auto page creation when a new user registers. It seems to work fine and it does what it supposed to ie. creates a page and sets the template. BUT although the meta says 910 827 _wp_page_template client_menus.php
    it dosent load in the edit window or load the template???

    function my_create_page1($user_id){
    	$the_user = get_userdata($user_id);
    	$new_user_name = $the_user->user_login;
    	$my_post = array();
    	$my_post['post_title'] = $new_user_name .'_menus';
    	$my_post['post_type'] = 'page';
    	$my_post['post_parent'] = '484';
    	$my_post['post_content'] = '';
    	$my_post['post_status'] = 'private';
    	wp_insert_post( $my_post );
    
    	$justposted = $new_user_name .'_menus';
    
    	$page = get_page_by_title($justposted);
    	// $page is the post array. To just retrieve the id
    	$id = $page->ID;
    
    	update_post_meta($id, '_wp_page_template', 'client_menus.php');
    
    }

    Please help I’m scratching my hair out ??

  • The topic ‘Auto page creation with template’ is closed to new replies.