The problem is $postarr["post_status"] = "published";
you should change it to
$postarr["post_status"] = "publish"; // Set it to 'publish', not 'published'
Now, this is a bit off topic, but you may want to omit the following (those are created by the wp_insert_post()
by default):
$postarr["post_date_gmt"] = date('Y-m-d H:i:s', time());
$postarr["post_date"] = date('Y-m-d H:i:s', time());
$postarr["post_modified"] = date('Y-m-d H:i:s', time());
$postarr["post_modified_gmt"] = date('Y-m-d H:i:s', time());
Related Posts:
- Create posts on user registration
- Create posts without login from frontend
- Posts added with wp_insert_post are moved to trash automatically
- Prevent duplicate posts in wp_insert_post using custom fields
- duplicate posts when trying to update a post using the wp_insert_post.
- Create new WordPress post [wp_insert_post] based on results of a WP_Query
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- generate unique slug while inserting post
- Email Post Attachment on wp_insert_post Action
- post_content sanitization / transformation process
- wp_insert_post – duration
- How to prevent duplicate posts with wp_insert_post on single.php?
- Creating a post from data returned from HTML form
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- post category in wp_insert_post
- When creating a post how do you select the format?
- Adding post date will not insert new post
- wp_insert_post not working fine
- Insert data from custom created PHP page into wp_postmeta table
- How to let a user create a post by submitting a POST form?
- wp_insert_post() Add and specific ID to the body of that
- Random post_id at wp_insert_post
- how to create a category with wp_insert_post and post_category
- Create posts by any logged in users
- wp_insert_post not inserting post
- Creating a frontend blog post form for logged in users only
- Insert new post for each user infinite loop error
- Is there any point to using wp_unique_post_slug?
- Admin notice on wp_insert_post
- ZIP up all images displayed in a [gallery] and offer as download link
- How to use “Add link” pop up for a WordPress widget
- the_author() returns empty string
- Custom permalink structure only for default posts
- Email admin when post pending?
- How to control which category will be picked for the slug of a post?
- How to hide the Text Area in the Post Edit screen
- WordPress Number of Posts Not Changing With posts_per_page
- Adding a Nav menu to post admin
- Comments enabled, but disabled at the same time
- Mass Update lines of code for all posts
- set role specific screen options in post summary page
- How to get a nofication when post submitted
- How to link up “read more” on excerpts hack from WP Recipies
- Any idea why wp_insert_post is succeeding but not returning?
- Planned private posts get published immediately
- How to get most recent commented post above new submitted post in WordPress?
- Get specific posts by ID in wordpress
- Change post_date to post_modified date on post template?
- Update Post creation date when updated
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- Query how many items to show in shortcode
- wp_insert_posts add title with count of posts plus one
- Relative redirects for posts, categories, products and product categories
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- WP Admin register taxonomy and post type performance
- How to get the last selected media alignment setting?
- How to make multiple sections in home pulling posts category wise?
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Highlight static blog page link in header
- What file is the standard frontpage that lists all the posts?
- wp_insert_post_data: Limit number of Page but Post get affected
- Possible to add a statement to a core file?
- older blog posts not showing in new theme
- Is there any way to stylize articles one by one?
- get_children returns older images
- How to display post title inside thumbnail?
- Banner appearing on Pages but not Posts; call it conditional confusion
- how do I get the title in the post [closed]
- Publish a Silent Post without updating Feed
- How to display a single(current) post from a category
- Delete post from admin but not from database
- Open a wordpress single post in a lightbox without the header and footer
- how to create a sub section in posts
- Filter out posts based on a certain post_meta on the WordPress REST API
- Separate top level categories on archive-product.php by meta
- How to add text before post_excerpt in Gutenberg
- Pinterest button shows image options from different posts
- allow user to create a draft post but not publish wordpress
- Comments are in database, don’t show up in WordPress backend or frontend
- Many buttons not functioning in WordPress dashboard (as admin)
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- Prevent WordPress from putting around specific element
- How to put the WordPress blog into theme
- How to correctly escape data
- Sort Events by Venue Title – Sort Post set by related post ids
- Get posts by category or author
- How to make post button to a random post
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- How can I have the posts from one word press blog show on the presentation page of another word press site
- How to pass multiple checkbox values to wordpress query?
- How to create three columns from selected posts
- Display the popular tags by default in the backend post edit page (without having to click on the link that displays them) [closed]
- Getting 404 when using rewrite rule for posts
- Posts and pages not getting published
- How to create a post based on data in a table?
- Last updated post in wordpress homepage first position
- How to make category for word post_content
- How does WordPress add the comments and comment form to posts
- WordPress + Polylang – Error 404 when trying to preview draft post on different language