Modified your code above to post to the custom post type “Bookings,” set to draft, and use the user ID number as the post title. I also added a return value for the new post id so redirecting to that id or linking to it is much easier.
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
$userPostsCategory = 3;
// Create post object
$my_post = array(
'post_title' => $user_id,
'post_content' => 'You can edit this or create a new story',
'post_type' => 'Bookings',
'post_status' => 'draft',
'post_author' => $user_id
);
// Insert the post into the database and return new post id
$itinerary_id = wp_insert_post( $my_post );
return $itinerary_id;
}
Related Posts:
- Creating a custom post type upon registration
- Get current user id
- Creating a custom post type upon registration for a specific user role
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Updating User Meta from Custom Post Field Upon Publish Not Working
- How to use a custom post type archive as front page?
- Set posts of a custom post type to be private by default?
- expire wordpress user posts
- Forcing all posts associated with a custom post type to be private
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page
- Best way to style first post differently?
- How to create user personal pages with information from their meta profile fields?
- if && problems with transition_post_status
- custom post type upcoming post and past post
- Add multiple custom post types in functions.php, but only one custom post type show in dashboard
- Beginner question: Accessing functions.php through admin web interface in order to import custom post types?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Need functionality with all post list available at edit.php
- Remove default post types on all sites except primary blog. WPMU
- How would I create a shortcode to display a custom post within a page or regular post?
- GravityForm: Populate Dropdown with custom post type [closed]
- Custom Post Types relationships
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Filter categories of posts with checkboxes
- Copy custom field value to post title
- Insert HTML inside link in a walker
- WooCommerce product search titles only
- Remove standard meta boxes from custom taxonomy
- What’s the difference between same wp functions get_posts(); functions in different form?
- Show category ID on custom post type
- Custom Post Type with Templates using Meta Boxes?
- Can I list a custom post type within another custom post type in the admin area?
- Set URL link to featured image of custom post type
- Change CPT archive title
- AJAX load more for different custom post type loops
- Team club with CPTs and user registration + user dashboard
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- create a new page from a custom post type similar to an authors page
- Users create/join groups
- Cannot save CPT meta box
- Creating a Custom Post Type and Joining with Users
- next_/previous_post_link() `in_same_category` appears to fail when true
- Want to be able to sign up subscribers as authors
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- categories should be available across all custom post types
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- Post-thumbnail only for specific post-types?
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Enable taxonomies by post type in an array of CPTs
- custom post for slider
- Excerpt function for any content
- Page Template Dropdown For Custom Post Types
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- providing access to post_id or post inside functions.php
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Get post format
- post_content is stripping HTML when adding a new post? [closed]
- Shortcode to return single custom post based on post taxonomy
- Template code to split a post and print a custom field?
- Send post changes to set email addresses (not users or subscribers)
- Function to limit number of custom post types on homepage – TwentyTen
- Foreach loop returning more than one item when querying taxonomy
- Meta box with front-end styling
- Post visibility option to theme front-end for author to select?
- Excerpt length: get first paragraph
- display custom portfolio tags
- display custom post on separate page
- Post type Echo code is repeating on homepage
- php dynamic content inside shortcode
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Assigning categories to custom post types via a front-end form; only works for native post type
- Default excerpt for parent of a custom post type
- Move to trash custom post type post after ACF Date Picker date is older than today
- From CPT Custom Loop into Shortcode?
- Create posts inside CPT post
- Load custom post type with ID in a shortcode
- How to assign post to category
- Using get_post_type with a custom URL format?
- If thumbnail image else post title
- $_SESSION Not working after X amount of page views
- Different Configuration for the_excerpt()
- WordPress page not showing up – replaced with last 10 posts?
- Post that populates itself (almost) automatically using data from imported excel file
- How to mark posts as visited
- can’t see categories in appearance-menu-categories
- Would like to add a “leaderboard” (custom field) to a custom post type
- send email to all registered users when post expires
- Display and Allow users to edit their own profiles
- Trying to display posts by authors in with specific user meta
- How can I get user URL by id
- Comments are not working on Custom Post Type
- How to make a non-public post on wordpress approval?
- how to display custom taxonomies in front page
- wordpress category form fields in popup
- How to display *block number* instead *date value* on WordPress posts?