// Add the content to $post as an array
$post = array(
'post_title' => $title,
'post_content' => $description,
'post_category' => $_POST['cat'], // Usable for custom taxonomies too
'tags_input' => $tags,
'post_status' => 'draft', // Choose: publish, preview, future, etc.
'post_type' => $_POST['post_type'] // Use a custom post type if you want to
);
wp_insert_post($post); // Pass the value of $post to WordPress the insert function
Related Posts:
- Use Notepad++ as HEX-Editor
- WordPress plugin archive
- Creating 20,000 Posts or Pages using a .csv file?
- How to transfer a WordPress blog to a different domain?
- Change Page’s Tag Using functions.php File
- How to update plugin without overwrite custom code
- WP get_permalink Return Wrong URL
- WordPress Plugin for One-Time Event Registration? [closed]
- Remove toolbar option (and set to default to no) in user profile
- [Plugin: Posts 2 Posts] reciprocal connections
- How to add a privacy-checkbox in comment-template?
- Can plugin variables cause conflict?
- MailChimp integration that allows users to select from multiple lists [closed]
- filemtime() warning when enqueuing style within plugin
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Post query – show posts from specified day and month and whole years
- How to add social locker on custom fields
- Accidentally Broke Site (Please Help) [closed]
- Add custom message to the plugins page of WordPress
- How to redirect to edit.php page after saving the post,product and showing the message “post saved “
- Apple push notification doesn’t work
- WordPress Ajax Posting from App
- Is any gallery plugin available to generate galleries from existing uploaded images? [closed]
- How Do I Figure Out What File(s) to Edit from Looking at the Source Code [closed]
- WordPress multi domain – redirect
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Is it possible make a back-end for WordPress with WordPress?
- Conditional attributes and logic per product category
- jquery tinymce and bundled wp plugins
- How create Group Blogs based on user created Groups
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Echo user id of users in seperate table
- How to upload multiple files/images when developing a wordpress plugin?
- HelpDesk solution for WordPress [closed]
- Best practice for including plugin output in a template without using shortcode?
- Recommend a flexible lightbox that allows an image or HTML to be used
- How to apply next/previous classes to LIs for pagination links?
- How to add an element right after the article using jQuery?
- How to reset wordpress but not plugins and settings
- WordPress reliability
- How do I avoid having duplicate of plugin in trunk?
- How to create wordpress widget that is fixed position on the home page
- Php page with filters for custom fields
- Advanced WordPress plugin activation detection
- Switch from wp-cron to a server cron job
- how to change wp-admin url using function file
- How to pass a query string to another page on the same site?
- I need a lightbox plugin that will apply to gallery [closed]
- How to add a link to our wp.org profile from wordpress.org plugin page?
- How can I remove the welcome message generated by the New User Approve plugin?
- how to make a wplang for network fill automatically
- Adding a Tag Parameter / Filter to My Shortcode
- Plugin privelages for “editors”
- Adding a jQuery modal dialog to the admin area
- Edit all $wp_scripts at once to $in_footer = false
- Ajax call not working in wordpress through a plugin
- Setting Author on CPT
- Cannot run script properly with my custom plugin
- Cookie value changes back to previous value after changing
- HTTP Error upload ( localhost )
- WordPress Dashboard add user password not working, etc
- Timber: Theme class not fetching the right directory?
- Hide Plugin Custom Post Type Menu Link
- Can you add a shortcode to a custom post type that gets the post_title, post_content, etc. and then passes that to a plugin function?
- Highlight admin menu items that are parent of existing core items
- Add external javascript to post template
- wp-admin/admin-ajax.php 400 (Bad Request) plugin
- Set up new WordPress domain using unclear files
- Getting all woocommerce products from REST API call in plugin
- Check if plugin is active outside of admin screen
- WP Rest Api GET method restriction on route, but POST method also works
- Accounting for search terms that may include a space, using SearchWP
- how does a plugin get active in wordpress
- How do I run my custom function in my plugin when a wordpress user is deleted?
- WordPress DevOps – Environments (Rancher, Kubernetes, etc…)
- Page Contents showing in Footer Area
- Update (a function) post’s featured image as soon as $image_url changes
- Widget logic using woocommerce product category
- Why is every single HTML tag being stripped out of liveblog entries?
- Using activated_plugin to run code
- Surviving WordPress and plugin updates
- How to order users alphabetically by name? in plugin UPME
- Create Database Tables on Plugin Activation hook
- Media Playlist Plugin
- Transition Post status not working
- Space in WordPress Attribute Causing Problems
- Is it possible to setup Category wise Subsciption?
- WordPress Background Audio – Continous AutoPlay
- Why won’t the Comprehensive Google Map Plugin load?
- How to change a specific page to custom page?
- How can I add different menus (different style menu) on each page?
- Custom Table doesn’t create on plugin activation
- How use Dynamic hyperlink on each wordpress post?
- How do I activate my child theme, as I do not see it in developer tools
- How to execute init or woocommerce_init only for checkout page
- Jquery based image accordian plugin
- Can’t modify plugin function
- wordpress jquery is not defined because the head tag is empty
- Filter custom post type returned from REST api
- WP Elementor Pro causing crtical failure on website