Check the docs at http://codex.wordpress.org/Function_Reference/wp_insert_post for the parameters to use with wp_insert_post
This function inserts posts (and pages) in the database. It sanitizes
variables, does some checks, fills in missing variables like
date/time, etc. It takes an array as its argument and returns the post
ID of the created post (or 0 if there is an error).
You run your function once in the context of a plugin, or worst case, in functions.php or in index.php and then remove it.
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- PHP/Manual use of images? – 2 Questions
- Set Primary category using the Yoast SEO plugin
- wp_insert_post not working
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Can’t get wp_insert_post to work
- Auto-Select Parent Category as Primary
- Don’t insert if permalink is the same?
- Getting error when using wp_insert_post()
- wp_insert_post() with HTML tags using PHP
- Add new post in existing categories using wp_insert_post
- get post id from wp_insert_post for get_template_part
- Returning all values from foreach in function php [closed]
- Generate CSV file and add data as a new wordpress custom post
- How to use `wp_insert_post()` and `get_permalink()` functions?
- how to add datas in taxonomy to post with wp_insert_post
- How can I pass php code as a content while publishing a post
- Meta inserted through wp_insert_post gets messed up
- how to call other plugins once custom post has been inserted
- Adding user meta to post meta wp_insert_post() not working
- Front end post submissions do not get submitted in the category
- Post content not showing some content
- 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
- PHP – Multiple variables in insert post array
- Can’t send form data to wpdb when URL has query string
- Can’t insert into a database wordpress
- Can I use the same nonce for multiple requests on the same page?
- WordPress and magic quotes
- How to check if a string is a valid URL
- Decrease file size upload in Media
- If Custom Field is empty don’t display div
- the_author_posts_link css class
- Design view breaking on Pages
- I want to remove the links from the term list returned by get_the_term_list
- error_log is not working as expected in functions.php file
- WordPress template_include filter not working properly
- query if on page/2/?
- How to display a value from a radio button in the options menu in wordpress
- How to debug php code in hostgator cPanel
- Put php variable in shortcode
- Web scraping using transients
- PHP Script for last login time
- Why the JavaScript code is ignored from wp editor?
- Send an email to specific adress when button is clicked?
- Unable to write multiple values back to ACF user field – PHP
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- PHP version problem?
- Why Won’t My Inputs in a form with a Get method work together?
- Extend PHP regex to cover “srcset” and “style” attributes
- WordPress Ajax Call inserting data but success response false
- WordPress function and string as variable?
- Theme’s Options Page included with require_once *.php in functions.php not visible anymore
- what do I replace get_bloginfo with and where do I find all instances of it?
- Using data sent via AJAX in multiple functions on a WP plugin
- Permission callback to check if user has application password
- Hide posts if user is added to it WP_query
- how to display this functions?
- How to have different site identity logos on each page on Astra Theme [closed]
- Set default Database Storage Engine when creating tables with plugins?
- How to tag the main tag? [closed]
- Overide Variable in Child Theme
- WooCommerce: Display product categories to make IF statement
- Randomize Color Scheme Selection in Theme
- Why can’t I add a custom image in my navigation?
- Calling a plugin from a page template in TwentyEleven
- How to deal with a GET variable of ‘name’?
- Hi need update in my terms for other taxonomy
- Free search and custom taxonomy query not providing the same result
- Replace a single variable with add_filter
- I am having issue in divi woocomerce checkout module. (DIVI theme)
- display condition based on post term and status
- Not able to remove caption shortcode from the content
- Display WordPress archive template page in 3 columns and not 1 column [closed]
- Only the first image uploads
- Trying to use a variable to set image width
- How to get all post status
- removing the standard dashboard widgets in WP so I Can replace with custom
- What is the correct way to search 3 custom fields only in WordPress?
- How to change order inside foreach using wp_enqueue_script?
- Change header on one page in WordPress
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- The link you followed has expired. Please try again
- How to Protect a private folder inside uploads folder, if User is not Logged In?
- Related Posts: if there is no category use tags
- Cleaner ‘for each’ loop for registering scripts in functions.php
- Premature end of script headers: wp-mail.php?
- New database entry to trigger runing PHP/SQL query through link with token, without logging into the website
- How to get all users by user_login as a json_encode array?
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- How limit the width of a fixed menu-bar on scroll?
- Subheader title depends on post – change to static
- Count posts per post-type for last month/week
- Use jQuery and AJAX to get HTML
- Make the text field in search form optional
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Adding a Sub Menu Options Page WP Backend Menu. Whats wrong with my code?
- how to add display_name
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?
- WordPress Query – Blog Cards Duplicate issue