I guess the reason is you have not added post title and added post id
$my_post = array(
'post_id' => 1,
'post_status' => 'pending',
'post_type' => 'post'
);
Ideally if should be
$my_post = array(
'post_title' => wp_strip_all_tags( $_POST['post_title'] ),
'post_content' => $_POST['post_content'],
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 8,39 ),
'post_type' => 'post'
);
Related Posts:
- Can’t insert into a database wordpress
- How do I make an HTML table from a database table?
- Inserting dynamic content into a page
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- Does WordPress cache get_user_meta() results?
- Export User Info to CSV from Front End
- WordPress admin never finishes saving page on site with large page count
- Retrieving and Displaying Data From a Table
- Refresh page after update_post_meta
- Search and Replace in database: How to replace data in SQL dump file on Windows?
- error importing localhost export file to server
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- How to sort results from a custom database table
- Why WordPress uses 4 tables to manage terms
- WP database error for comments_popup_link()
- No wp-config.php file on local install of wordpress – site still displays
- How to create Sub Sub domain Multi User blogs?
- How to find the output of contact form 7 shortcode? [closed]
- Issue with foreach on duplicate meta_key’s
- Different database query in function.php using mysqli
- Proper way to edit a post via phpMyAdmin without breaking the compare revisions tool
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Store and Work with huge array in WP [closed]
- Adding Custom Forms
- Why is the post meta[] empty when I make a call to the wordpress rest api?
- Is it necessary to sanitize wp_set_password user input?
- WordPress Scheduled Event Request Blocking
- Create WP_Query to search for posts by their categories or their parent/child categories
- Is it possible to create a wordpress database with php code?
- Update results, Before deleting the related category [closed]
- Don’t insert if permalink is the same?
- Store a default value for a transient on plugin activation
- How WordPress reacts to a lack of memory of the server [closed]
- Split reads to a different connection string
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- database sent to a JSON file
- inserting a post from an extern php file but post content doesn’t show on wp site
- Databases – Submitting data from inputs to database [closed]
- Filtering a Database Query
- Is it best to avoid using $wpdb for security issues?
- Blob file download problem
- How to retrieve the data from the sever and displaying it in a page?
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- wp_insert_post() with HTML tags using PHP
- How can I find the cause of a 500 server error?
- I can’t update my data through $wpdb
- Can’t successfully check if post with title exist in database
- Lost in trying to create user database system
- Delete database record using plugin from admin panel
- How to get image from url from the database?
- Wpdb get->results to out the the month from the db
- Returning all values from foreach in function php [closed]
- Filter results from a serialized string to use on statistics
- How to add data to a custom field at the wp_users table?
- Creating custom page template from existing PHP site
- wordpress site – using custom database and PHP
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- Add row to custom database Table and delete all rows older than 1 day
- Database entry removed on browser refresh, Ajax PHP jQuery
- Please help! I have a problem with getting wordpress databas
- Change wordpress’ database data using ajax – how to get current user id?
- Error establishing a database connection (Set-up locally)
- add role on WordPress in PHP on a second database
- Limiting posts based on nested meta_query
- Preserving backslashes in post_content
- Error establishing a database connection (configuration)
- Retrieving and Displaying Data From a Table
- Using custom php to connect to database blocks wp from accessing galery pictures
- Can I disable auto increment of WordPress Posts Database to utilize previously deleted records?
- Updating the database after parsing CSV document
- How do I fetch a data from an external database into my wordpress homepage
- How to display post_content from database in different on template page?
- Adding user meta to post meta wp_insert_post() not working
- Issue in url update when using wordpress update query
- direct query to post_meta table
- can’t delete a row from post_meta table
- special characters not supporting in wordpress
- How to set max users to 17.000
- How to fetch results from database
- Unserializeing multiple column values that are stored in one database results variable
- Best way to define a database with product codes and back-end support?
- How to connect database table to each registered wordpress user.
- Querying multiple meta_keys in WordPress SQL query
- Post content not showing some content
- Create an unique ID number after submit form
- upload images on front by user using form
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- How do I empty a specific meta_value for all users in PHP
- Create custom table for wordpress custom registration flow
- Custom form that stores data in mysql database
- How to get data (not value or name) from radio options to POST to database
- Creating a table via dbDelta
- wpbd to connect to a VPS mysql database
- Retrieve data from external database and insert back in
- How to get the last date updated of postmeta?
- Putting form result in my database
- Issue with WordPress Plugin Activation Hook and Table Creation
- How to improve the performance when using a flat-file dataset and PHP for implementing advanced search function?