First, add the custom field to the registration form:
add_action( 'register_form', function(){
?>
<p>
<label for="institute">Institute</label>
<input type="text" name="institute" class="input" value="" size="25">
</p>
<?php
} );
Then, hook to user_register
action which gets called after a user has been registered succesfully.
add_action('user_register',function($user_id){
$my_institute = array (
'post_type' => 'Institute',
'post_title' => $_POST['institute'], // Custom field value
'post_content' => 'This description is not needed',
'post_status' => 'publish',
);
wp_insert_post( $my_institute );
});
Related Posts:
- clients list using wordpress
- echo value from ‘select’ field type into page template using cmb2?
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Saving multiple Metabox contents
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Copy custom field value to post title
- Save an array from drop-down in custom meta box
- get_post_meta not working on publishing
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Cannot save CPT meta box
- Redirect to another page using contact form 7? [closed]
- Warning: Invalid argument supplied for foreach() [closed]
- ACF in wordpress
- How to inherit field value from parent post into in child / sub post
- Custom post type in Custom widget – $listItem
- Let users upload image(s) to the post from front end
- Insert custom fields to a custom post type
- Excerpt length: get first paragraph
- Update value inside array update_post_meta
- Custom Form / Search with Custom Post Type Data
- How to convert Post Object Custom Field into Tags
- Problem with multi checkboxes value in metabox?
- Populate custom post type/custom fields from an external database
- Custom Field to post_title
- custom post type does not working when adding in child theme function
- Function not pulling image or text from custom post type
- I want to split this into two functions
- Display custom posts in checkbox list
- Allow authors to create article image
- How to display *block number* instead *date value* on WordPress posts?
- Including Custom Meta with posts_where query
- Add custom column in custom post type edit page
- Populate Custom Fields in a Custom Post Type?
- WP All Import – Using Xpath to set a select value
- How to change post featured image using a custom field of category?
- Publish an XML feed from a CPT with ACF fields?
- wp_insert_post generates endless posts
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Remove standard meta boxes from custom taxonomy
- How to create shortcode to display custom field value on a custom post type
- Confusion regarding Nonce & using it in Custom Columns for Saving Checkbox Value to Post Meta
- Automatically update custom field in all posts of a custom post type
- What’s the difference between same wp functions get_posts(); functions in different form?
- WP_Query: include custom post type only with specific meta value
- I did group my search results by post type, but how can i give each of them its own order?
- Is there a way to get a file URL from the relationship ACF field?
- Display custom fields on post excerpt or teaser
- Dequeue scripts and styles only for specific custom post type
- WP_Query orderby modified to include custom meta changes
- Function to display custom post type on front page makes menu items dissapear
- WordPress custom loop filter by meta_key and value with serialize data
- Adding Show Less/More link to Custom Post Meta
- Returning a list of custom post types excluding those without a specific meta_value
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- custom post type not showing in menu
- Keep display metadata value on backend – Custom Metabox
- How to bulk copy custom fields between custom posts?
- Show category ID on custom post type
- Sorting custom post type columns with external data and without meta values
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Meta Key Value in current-user-only loop
- How to customize a permalink (URL) structure?
- Retrieve value of a category’s custom field
- Calculate all custom field values in the post loop
- Rewrite and custom post type: order by custom field not working
- Plugin: register custom post types, child ready and performance best practices
- add custom field to custom post type
- How to set up multisite for multi language?
- CPT Group by Date metabox Value
- How to check if user meta field is empty in conditional else statement
- Replace text in post from cvs
- Admin search ACF relationship
- wp_query check if integer exists in custom field’s array
- Custom Post Type with Templates using Meta Boxes?
- making available just some parts of theme option
- How can I dynamically add a post to a custom post type which uses a custom field?
- Can I list a custom post type within another custom post type in the admin area?
- Change custom post type slug from plugin options
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Custom Posts Types as Custom Fields
- Get image post ID in media upload
- Why is my select meta data not saving?
- dynamically add a custom field or metabox to custom post type [duplicate]
- Give a permalink to Custom Post Types without title
- Role scoping for contributors down to the field level
- How to implement a Google map store locator
- Creating a Custom Post as a repository for theme constants
- Rewrite post type slug only for child theme
- search also in taxonomy, tags and custom fields
- Random image from tag/custom type on sidebar
- Can’t edit custom post type
- How to stick custom post at the top in search results
- How do I create custom fields for multiple post types?
- How to store multiple values in 1 meta_key with radio input?
- Add field to all custom post types
- Query & Order posts by custom fields
- Filter custom posts using auto populated dropdown selectors
- How do I associate a custom post type with another through a taxonomy or storing an ID in a custom field?