Try add the second parameter like:
$post_id = wp_insert_post( $new_post, true );
If it still won’t work, please var_dump the $post_id and paste here.
Related Posts:
- Fetch All Posts (Including Those Using a Custom Post Type) With WordPress API
- get post type plural
- Get post ID from wp_insert_post()
- WP insert post and custom taxonomy
- REST API: How can I restrict a custom post type to only be accessible by authenticated users?
- How do I programmatically add items of content to a custom post type?
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- How I upload, save and set a featured image from my frontend?
- How to create download links based on Custom Fields with Rewrite API
- Trying to save custom post type from frontend partially working
- wp_insert_post custom taxonomy
- Assign category to front end post
- Custom post metadata not appearing in public API
- How can I programmatically save data into custom fields that contain serialized data?
- What hook should be used to programmatically create a post only when master post is updated?
- WordPress tax_input only if logged in
- Programmatically adding posts
- Is it possible to create a post using a metabox?
- How would you associate location data with a post?
- Custom Post-to-Post with multiple parents?
- How Can I Set the Post Author of a Post I Just Created With PHP?
- How to auto increment post title & post slug field?
- Auto-generated posts not showing in backend (but being counted!)
- wp_insert_post generates endless posts
- How do I get the intended post type of a revision post?
- create parent post using wp_insert_post
- Make parts of your wordpress website completely built with data from external APIs?
- Cron job for creating posts not excecuting properly
- Database to page routing API?
- How to checked selected category checkbox when my custom post inserted from frontend
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- Post author for revision not being set on update/insert
- Add CPT values to Database
- Why cant I add a custom post type to a custom taxonomy?
- Pros and cons of a custom page vs custom post type template file
- Creating tags via API
- CRUD operations in wordpress
- wp_insert_post wrong post type [closed]
- Programatically inserted posts not showing in Posts Table
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- Update post if exist from PHP
- WordPress custom API endpoint – how to make the request more flexible
- Custom REST endpoint not working to retrieve single posts (“rest_no_route”)
- WordPress hook which triggers on post import
- How to handle new post from API request?
- WordPress as a backend for external service? [closed]
- How to handle this specific case of custom post type?
- Custom permalink structure for remote content pages
- insert image with custom post type
- importing table data to custom post type
- How can I get some of a posts meta data whilst it is still inserting?
- Use Gravity Forms and a Shopping Cart for output to Freshbooks for an Estimate [closed]
- See if the email exists or not
- WP_Insert_Post creating duplicate posts when logged in
- Sync posts via JSON API
- wp_insert_post from XML feed only inserting first post
- Use a template for a specific url slug without creating a page
- What is the correct way that when creating a custom post type assign values to custom fields created with pods framework?
- How to Grab Anime info using Jikan API and fill the value in Metabox
- How do I find out which (page) template file my custom child post is looking for?
- How to display “META” array in register_taxonomy
- wp_insert_post deleting previous post custom meta
- Populating Custom Fields from live JSON
- Published page but it is page not found
- How to insert post 6 times after user register like ask.fm
- wp_insert_post() creates duplicates with ‘post_status’ => ‘publish’
- WordPress API only returning HTML
- automatic creation of custom post type articles
- Submitting custom post from frontend,jQuery ajax, and custom validation – can’t find proper place to insert wp_insert_post()
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Generate slug and meta data if meta field is empty
- Add a image to a post published on a CPT from the front-end
- Insert custom post data in to MailChimp campaign email
- wordpress form processing to custom post type not working
- install.php Custom Taxonomy Term not being added to custom post
- Omitted Content After Post-Publish Insertion
- Is this the correct way to add post-slug input field?
- After wp_insert_post() custom post type does not show in the admin
- Custom plugin contact form connecting to mailchimp API
- display posts, pages and custom post types from another wordpress site
- Using wp_insert_post to create custom posts with ACF image field
- How to consume external API from WordPress post editor and display the response data in the custom field?
- Appointment booking system in WordPress
- Post current post type to my Ajax
- Add a post when another post type is inserting
- How to add a post page from a button without reloading
- Slug Confusion Between Post and Custom Post types?
- WordPress custom slug rewrite
- Which Template Page Should I Use?
- How to change path for default WordPress blog posts?
- Custom Empty Results page for my Custom Post Type
- How to find a specific post_type using its “rewrite slug”?
- How to get a custom type post data when it has a connection with another custom type post?
- How do I create an overview page with custom calculations from a post-type?
- disable quickedit for specific custom post type user role
- custom post type template
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- Get Post Terms of Current Post (selected taxonomy term) – How to get only the taxonomy value and not “Array ( [0] => taxonomy term )” in the frontend?
- Replace dynamically content in a custom database table when a custom post is created