You need to add the post via function call wp_insert_post. where you need to pass the parameter of post type as name of your custom post type.
$wordpress_post = array(
'post_title' => 'Post title',
'post_content' => 'Post Content',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'custom_post_type'
);
wp_insert_post( $wordpress_post );
Hope this helps
Related Posts:
- Displaying custom meta box value in a custom post page
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- I want to show image from custom field image on my custom page template
- fetch from an external api call and display results in page
- How to update custom fields using the wp_insert_post() function?
- Call to a member function add_rewrite_tag() on null
- Adding custom input for data attribute in insert media modal
- Search that will look in custom field, post title and post content
- If Custom Field is empty don’t display div
- Custom Meta Field – Youtube embed
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- Print html when custom field has value inside while loop
- Update WordPress Custom Field with AJAX on cached page
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- how to increase custom post value by one most efficiently?
- Sum custom field values of particular taxonomy
- Importing hard coded custom field into acf field
- Passing the custom field values in the wp_get_current_user array function
- Replace text in post from cvs
- Firing schema via code in functions.php doesn’t work
- Using custom field content as expression in IF statement [closed]
- How can I add extra word in permalink when someone click download button?
- Seach custom post type posts only by meta fields?
- auto-populating custom nav with all items from custom post type
- conditional logic for front-end custom field edits
- Displaying custom field according to date
- Automatic Shortcode Creation with Custom Fields [closed]
- Custom field values to taxonomy terms
- Add additional field to custom post_type
- Which PHP page is the Default Posts Page
- Non-Closing PHP Query in WordPress Loop
- How to check if a PHP string is different than meta field?
- Display custom field on 404 page outside loop
- How to show/hide php table rows based on the content of custom fields
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- How to show meta value code HTML after x paragraph
- Creating an image from a custom field
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Output custom text field as unordered list
- Conditional featured image with youtube thumbnail
- Order a WP_Query by meta value where the value is an array
- Unable to render custom field after attempt to generate a list of recent post in page template
- Add a custom class to the body tag using custom fields
- WordPress stripping out custom field tags
- Display additional user fields
- How to create repeater field manually, without plugin (ACF Pro)?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- Updating Metadata with Shortcode
- How do you save the values from custom fields to a products data
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Query custom post type that has a serialized relational advanced custom field value
- Trying to update Woocommerce meta values
- Is it possible to update the dataset using update_post_meta
- Setting up a cron job to auto update a custom field
- How to Call on WordPress Custom Fields without a Plugin
- WordPress hide post from custom post-type on a single page
- Query on a repeater date (acf)
- Save custom field on WP_List_Table
- Trying to retrieve meta values from three different meta keys and display in rows
- WP post meta – for loop inside for loop
- custom fields anchor points php
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- WooCommerce multiple custom fields code
- Updating Lat and Lng of posts automatically gives sporadic results
- WP_query meta_query slow with OR and DATES
- Get meta_query value by user meta array
- meta field for numerous links
- Include a custom field in mysql query
- Get month and day from a Date Picker custom field
- divide custom field values in div every two values
- Showing custom field contents without listing description
- How to exclude post from being queried based on custom meta value
- Show Custom Post Type taxonomy term that matches custom field
- Display a query with multiple post types and same relationship on a single page
- Order by custom field attribute
- Select Menu for Custom post Type does not save
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- Posts sortable column not sorting properly for custom field numbers
- Search result page – display values from the result’s metaboxes
- Query posts by custom fields (object post)
- ACF Date fileds to Age Convert [closed]
- Save custom field value to variable for conditional – why is this not working? [closed]
- WordPress different custom tag being displayed in on tag list
- Can I associate a custom post type with another custom post type?
- How do I organize posts based on their taxonomy?
- How to use multiple custom post types to archive as front page?
- Custom Admin Menu Report for Specific User ID
- Why do I get a 404 error on my custom post type archive pagination?
- Shortcode Displays 2 times
- Custom post type removing /page/2/ from URL when trying to access it
- WordPress CPT & Custom Taxonomy with the SAME Permalink Structure
- Hot to show custom post type taxonomies on archive page
- wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
- child category under correct parent
- ACF block gutenberg aligncenter don’t work
- Display WooCommerce Order Custom Field In Template (HPOS)
- Send summary email from a form with wp_mail
- How can I display a layout differently depending on whether the user is on Mobile or PC?