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 to update custom fields using the wp_insert_post() function?
- How to return number of found rows from SELECT query
- How do I make an HTML table from a database table?
- what is the use of /wp-includes/SimplePie?
- How to check if image is already stored in a site’s post database? (network)
- Inserting dynamic content into a page
- Check if post of title already exists
- How to export/import theme customizer settings?
- $wpdb->delete column values IN ARRAY()?
- Inserting choice in database table
- WP API V2 returning Invalid User ID
- How To Make Connection To WordPress Data Base In A Plugin?
- Has anyone tried putting PHP ActiveRecord on WordPress?
- PHP/Manual use of images? – 2 Questions
- Changing user_nicename
- Does WordPress cache get_user_meta() results?
- How to auto login user again after change user_login
- WordPress will not operate correctly
- Export User Info to CSV from Front End
- How to Join two tables from separate databases within WordPress
- 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?
- Duplicate domain database to local – How?
- 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
- how to call other plugins once custom post has been inserted
- Full search and replace isn’t enough to make all pictures to be loaded with https
- How to display post_content from database in different on template page?
- Generate random access token to a post page
- Adding user meta to post meta wp_insert_post() not working
- How to query a staging database?
- Get meta_query value by user meta array
- Front end/Database connection in WP
- I changed the password for the database user of my website, updated wp-config.php and wordpress asks to be reinstalled
- I want to use wordpress database in android app using json encode?
- Issue in url update when using wordpress update query
- direct query to post_meta table
- can’t delete a row from post_meta table
- Child theme functions.php file change database entries
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Can form entries from a WordPress form go to a database
- AJAX Not Working With WordPress Database properly
- 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
- Weird Behaviour: Not all WordPress Posts appearing
- Can not manually create a database ( db, user, pass ) for a plugin
- two wordpress sites, two themes, one database, same content
- Insert double entry in DB
- How to fetch results from database
- Manipulate database of WordPress site with my own scripts
- 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.
- Problems with plugin that fetches data from database with ajax
- Check if values exists DB
- Querying multiple meta_keys in WordPress SQL query
- Let users register weight each day and save it in DB
- MySQL database migration to WordPress
- Post content not showing some content
- 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
- Query specific posts per user selections from dropdown menus
- Custom query_posts() parameter
- Create an unique ID number after submit form
- How to print array of specific item
- Fetching wpdb data from a php file seems to break?
- upload images on front by user using form
- How to check if a value exists in one of two database tables
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- PHP Call to External Database
- Insert into db with foreach problem
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- notify users when changed 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
- save array of objects with update_option
- Create custom table for wordpress custom registration flow
- PHP – Multiple variables in insert post array
- Execute multiple PHP Snippets causes error?
- Can’t send form data to wpdb when URL has query string
- 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
- Bulk data save in custom table
- Issue with WordPress Plugin Activation Hook and Table Creation
- WordPress Insert line in DB when clicking a button
- Updates applied to staging WordPress site affecting production even with different databases
- Failed PHP 8.0 Upgrade
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- How to improve the performance when using a flat-file dataset and PHP for implementing advanced search function?