You can add it this way, you send the tags separated by commas.
// text add
$my_post = array();
$my_post['post_title'] = 'title';
$my_post['post_content'] = 'text.';
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_category'] = array(8,39);
//database add
wp_insert_post( $my_post );
Related Posts:
- What are the differences between WPINC and ABSPATH?
- Using require_once in a Plugin?
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- Errors while using ajax from external wordpress page
- shortcode doesn’t work
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Scope for PHP Variables Assigned in functions.php or a plugin
- Plugin Development sqlite or WordPress’ database
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- Where should I save an API key of my user when installing my plugin?
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- WP Post Template – Templates in own folder
- wordpress plugin is not activating from widget
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Image upload and download from front-end
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- What are the specifics of WordPress development I need to know? [closed]
- Ajax call returning 0
- How to replace WordPress Media Upload Window with user’s device window?
- Conditional attributes and logic per product category
- How to create a custom post type that contains another custom post type?
- Redirect to another page using contact form 7? [closed]
- Setup wp_schedule_event within a custom plugin
- Activate my plugins via FTP
- How to add apply_filter for a class property in plugin
- Issue running db create table query from static method
- execute function after one completed
- How to make multiple admin pages for one plugin?
- Integrating boxtal PHP library into a custom WordPress Plugin
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Why is it important to check for isset and is_array before checking in_array in this example?
- How to add/change (woocommerce) product tab icon
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- I want to generate the pdf and save it in library?
- Using meta_query in a WP_Query not working for numbers properly
- How to call external functions from a PHP script in a WordPress plugin?
- How to write to a separate PHP file in plugin settings
- Create “new pages” within the admin section of plugin
- More gentle way to hook WordPress custom url
- How to display results from a data table with an encrypted user id?
- How to add custom function to pluggable.php
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- How to Add text value in Automatically in this conditions?
- Checkbox show / hide output result
- save_post_product action not firing
- How to get the custom field value using SQL query
- admin_notices show after load completed
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Problem with checked box on wp car manager plugin
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- WordPress rewrite rule depend on meta values not ids
- How to change “Read More” text?
- How can I see $post object in frontend from functions.php?
- Move plugin pages from dashboard to front-end
- Problem with wordpress has_action() function
- Offering a freemium plugin (a free version + paid version)
- Using id to show item
- 500 Internal server error wp_handle_upload_prefilter
- Can’t access 3rd party API, code works on local server but not on wordpress
- Generate and send ICS file through WordPress
- Get post content inside plugin class method
- Is admin section completely customizable in terms of styling?
- Woocommerce list variations that are added already to cart in Single Product
- Change pricing in Woocommerce based on Category and Product [closed]
- WordPress environment not loading properly
- WordPress not displaying information on post sent from custom admin form
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Creating a user ‘add custom field’ section
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Doing action based on input from options menu
- Help me with my first very basic plugin
- Load my plugin before cache
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- How to create post comparison in wordpress
- wp_handle_upload – specified file failed upload test
- How to make a Template page to show the information of different things Shop and Product page?
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- public custom posts not showing in my wordpress plugin
- add_action() not working for admin
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- Plugin question, How to insert a colon in a value box
- Woocommerce attatch files and custom input meta to cart items and then to order
- Call to undefined function create_function() – PHP 8.2
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1