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?
- How to use a custom post type archive as front page?
- Set posts of a custom post type to be private by default?
- Custom Taxonomy Template Post List with Sort Order
- Display Custom Post Type Fields
- Date archives for custom post type
- WordPress query by multiple Custom fields and order by date
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- Append taxonomy terms as class names in markup?
- Bulk edit custom excerpt text in WordPress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Getting a “Changes you made will be lost” dialog prompt on a custom post type page
- Search Custom Post Type Custom Fields
- Saving repeated option values in a custom query
- How to remove slug metabox from custom post type’s page?
- GravityForm: Populate Dropdown with custom post type [closed]
- Custom fields in Permalinks?
- Notice: Undefined index: suppress_filters
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- List of Posts in a Custom Field
- Confusion regarding Nonce & using it in Custom Columns for Saving Checkbox Value to Post Meta
- I did group my search results by post type, but how can i give each of them its own order?
- CPT Group by Date metabox Value
- Replace text in post from cvs
- Admin search ACF relationship
- How do I create custom fields for multiple post types?
- Trash / Draft a WordPress custom post after custom date field expires
- Posting to a Custom Post Type from front end – user generated content
- Custom Meta Field – Remove comma from string with str_replace
- Query taxonomy of taxonomy of custom post type
- Filter custom post types by a field value
- How to change permalink to include custom post type
- Is it possible to activate customfield ‘text description’ upon activating the customfield ‘checkbox’?
- Custom Field values not Showing in Edit Page of Custom Post Type
- Add a custom meta box for client to order CPT posts how they want
- create custom meta box with default value
- Custom Taxonomy Search result page
- Get current user id
- Increasing the default number of posts in custom post types
- How do I disply an array inside a custom post type?
- How to call a post’s metadata in shortcode.php?
- Custom posts – tag pagination
- Getting custom post types to properly display alphabetically
- Ideas to connect external database table to wordpress posts as custom field source
- Adding custom post formatting options in custom post types
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Function to add custom HTML into head in custom post-type list page
- Submit Custom Postypes from frontend
- Need help with Custom Post Types and Taxonomies
- add_filter get array data before display in custom post_type
- Get previous and next custom post by custom field
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Auto generate excerpt from ACF field on a CPT that does not support excerpt or content
- Query custom post type and custom field by URL parameters
- Create posts inside CPT post
- Show Post columns to specific users on condition
- Store custom field’s multiple values in one user meta key
- Create Inclusions and exclusions
- Work and Display a Custom Post Type as a normal Post
- Post Custom & Taxonomy 404 error
- Get month and day from a Date Picker custom field
- Custom Info Box at end of posts?
- Query Distinct Taxonomies of Custom Post Type
- loop through custom post-type with two meta_keys
- Comments are not working on Custom Post Type
- Send email on creation of custom post type and use get_post_meta()
- WordPress does not show the custom fields box
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs
- post__in select all custom posts and not the selected array of ids