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
- WordPress hide post from custom post-type on a single page
- Inserting a class on before_widget if checkbox is checked
- when looping through custom post data not appearing
- Query on a repeater date (acf)
- Generating 3 random numbers and saving them in database
- Where does php code to load data go?
- ACF – Can’t get custom post type by taxonomy
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- Save custom field on WP_List_Table
- Sum All the Post Meta of Published posts of Current Logged in user
- How do I get the value of a current user’s custom field?
- 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
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- PHP Puzzle: Unique Styles with PHP loop
- I want Page titles and excerpts to show up on home.php in certain order
- Posts sortable column not sorting properly for custom field numbers
- How do I filter a custom post type loop by a field?
- Search result page – display values from the result’s metaboxes
- Display custom meta box in my template file
- 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]
- Metadata on the WP_Post object
- Get custom post fields and display them
- Appending an ACF custom field to the page title
- Too many if’s and else if’s ?? – Must be better way [closed]
- Advanced Custom Fields Show PHP in Text Areas
- WP query with variables gives no result for specific user
- Display all categories (with link) of custom post type – WordPress
- Send email on creation of custom post type and use get_post_meta()
- Grabbing value of input field inside of array
- How can I get values from a custom post type depending on where I click on my SVG map?
- WordPress different custom tag being displayed in on tag list
- How to enable REST API on custom post type without Gutenberg?
- Can I associate a custom post type with another custom post type?
- Get category name of current post (CPT UI)
- Convert custom field date format to “WordPress default”
- How to sort custom sortable column by custom table value
- How to disable page create for custom post type, but allow a page with the post types slug to be created?
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How do I organize posts based on their taxonomy?
- How to use multiple custom post types to archive as front page?
- How do you create a front end form that enables the editing of member-specific custom fields in WordPress?
- How to make multiple custom taxonomies sit under custom post type slug?
- Search custom post type posts only by meta fields?
- How to pass value to add_filter wpcf7_form_tag from another function?
- Limit a search box by CPT + taxonomies, in only one page
- WordPress taxonomy and terms question
- Load style and script for custom post type metabox
- Custom CPT – Programmatically create categories to assign CPT when a new one is created
- Custom Admin Menu Report for Specific User ID
- Why do I get a 404 error on my custom post type archive pagination?
- How do I exclude the current post from the upcoming post query
- Save_Post change Custom Post Type Post title to post id number
- Shortcode Displays 2 times
- How to execute a shortcode within a custom field?
- Custom Filtering date with newsletter
- Ajax infinite scroll random order shows duplicate posts on custom post type
- ACF number less than comparison not working
- Custom post type removing /page/2/ from URL when trying to access it
- Same Custom Post Type Slug and Custom Taxonomy Slug, with hierarchial unique permalink structure
- WordPress CPT & Custom Taxonomy with the SAME Permalink Structure
- Problem with custom user fields default value and retrieval
- Cannot Access ACF Field Values via my Plugin
- Remove slug and custom post type name from URL
- 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
- Integrate a Custom Post Type with Learndash Plugin
- How to create advanced custom fields for backend content
- child category under correct parent
- Remove slug of multiple custom post types with and without hierarchical
- Quiz page template, checked attribute missing when option selected
- ACF block gutenberg aligncenter don’t work
- Redirect WordPress page to the latest created post by the logged in author/user
- How to pull through page title depending on which radio button is selected on the specific page?
- Display WooCommerce Order Custom Field In Template (HPOS)
- Is it possible to go to the next post in the same category?
- 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?
- hide “Open in New Tab” checkbox in link field
- create custom post type and populate custom fields using php
- Exclude function for custom pages, exclude custom ACF fields
- Custom Post Types in WordPress Dashboard List Rows But Data is Blank
- Options of select field in a custom divi module ignore sorting
- How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code files?
- How to get the post title inside a custom block in a loop? block.js
- How to Bulk Update CPT Taxonomy Values Using CSV Lookup Table
- Custom rest fields not loaded in rest api cpt response
- Set custom post type to load custom block pattern by default
- Post returns 404 after changing the permalink using post_type_link
- Display posts in correct month order using single date custom field
- Cannot access the other pages after successfully editing post type