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?
- Does WordPress cache get_user_meta() results?
- Refresh page after update_post_meta
- Search and Replace in database: How to replace data in SQL dump file on Windows?
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Why WordPress uses 4 tables to manage terms
- Import 10,000 Users into WordPress WITH a specific ID for each user
- WP database error for comments_popup_link()
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- 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
- How to generate page content from database the right way?
- 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]
- phpMyAdmin displays error when importing database
- Adding Custom Forms
- How to get the POST TITLE using the POST ID?
- 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
- Can’t get wp_insert_post to work
- Trying to establish connection to External Database
- How to insert a single row to WP database table?
- $wpdb->update with multiple parameters gives error
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- Is it possible to create a wordpress database with php code?
- Don’t insert if permalink is the same?
- Store a default value for a transient on plugin activation
- Split reads to a different connection string
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- inserting a post from an extern php file but post content doesn’t show on wp site
- Getting error when using wp_insert_post()
- Not connecting to database in file with multiple MySQL connections
- Display Data in Table from External Database in WP using Shortcodes
- How to retrieve the data from the sever and displaying it in a page?
- Building a REST API for your web app exposes primary keys of DB records?
- wp_insert_post() with HTML tags using PHP
- Saving data from custom form in wordpress database
- wpdb Cannot Update column in Database
- Lost in trying to create user database system
- Get wp_current_user_id using PHP and MySQL
- WPDB – Read and write value from / to database
- How to Generate a list of Most Commented post?
- How to use `wp_insert_post()` and `get_permalink()` functions?
- Adding data to custom wordpress database table
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- Add posts to custom table in database instead of wp_posts
- Using PHP Code Snippets to query a database, $dbconnection->get_results is outputting nothing
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Please help! I have a problem with getting wordpress databas
- How can I pass php code as a content while publishing a post
- Submiting with problems on one of the options php wprdpress
- Error establishing a database connection (configuration)
- Confuse between forms and tables
- code that I can run, or a plug in to show what sql tables something pulls information from
- Adding column to wpex_users
- Editing the term_order field
- Meta inserted through wp_insert_post gets messed up
- WordPress database error only while loading page for 1st time
- Multiple WordPress sites with different theme and plugin sharing the same content
- How to grab data from input and store it into custom table in database?
- Insert data from form to database
- How do I fetch a data from an external database into my wordpress homepage
- How do I fetch a data from an external database into my wordpress homepage
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Generate random access token to a post page
- I want to use wordpress database in android app using json encode?
- direct query to post_meta table
- Child theme functions.php file change database entries
- special characters not supporting in wordpress
- How to set max users to 17.000
- Front end post submissions do not get submitted in the category
- two wordpress sites, two themes, one database, same content
- 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?
- Check if values exists DB
- Querying multiple meta_keys in WordPress SQL query
- MySQL database migration to WordPress
- Host does not allow remote connection, so how do I transfer data to my WordPress site?
- Trying to post information from a remote database to wordpress page
- MySQL Engine vs. Charset
- Custom query_posts() parameter
- How to print array of specific item
- PHP Call to External Database
- Display total count of products in orders of a specific order status
- 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