How to create a custom post automatically while registering a custom post type
-
I am using the following function to register a new custom post type on my WP site.
function new_projects() { $args = array( 'label' => 'Our Projects', 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug' => 'our-projects'), 'query_var' => true, 'show_in_menu' => 'themes.php', 'menu_icon' => 'dashicons-awards', 'can_export'=> false, 'menu_position' => 100, 'supports' => array( 'title', 'editor', ) ); register_post_type( 'our-projects', $args ); } add_action( 'init', 'new_projects' );
And it’s registering a new custom post type named Our Projects.
Now, with that I want to auto create a post under this custom post type namely ‘Our Projects’ or so.
How can I execute this?
Thanks
- The topic ‘How to create a custom post automatically while registering a custom post type’ is closed to new replies.