After some hours of further searching i found the solution:
wp_set_post_terms($pid, array("2"), "project-type");
Related Posts:
- Which action for triggering cron “wp”or “init”?
- wp_schedule_event in a class
- WP Cron – Run Cron after evey 15 minutes at a specific time for the next three hours
- Using wp_cron with custom time interval and the register activation hook
- WordPress scheduled task is called but not executed
- Problem creating cron job wordpress
- How Do I Make WordPress Run an Event Every Day?
- How can I change the frequency of a scheduled event?
- Hourly WP schedule, do I need at least 1 visitor hourly?
- WP Cron doesn’t save or in post body
- Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?
- WordPress cron running twice
- Is there a faster way than wp_insert_post to add content to a blog
- Scheduling a task using class methods
- What is minimum time interval for which a cron be scheduled?
- Will cron job run if page loaded is being served from cache?
- update post meta for checkbox in the admin when inserted in the front-end
- Programmatically detect if wp-cron is disabled?
- Set page template programaticlly in plugin
- How to schedule a cron job in plugin without waiting for page load request?
- $_FILES empty on created_{taxonomy} and create_{taxonomy} yet is is not on edit_{taxonomy}
- How to perform a heavy and long process in cron jobs?
- Why is the WordPress taxonomy not registering?
- How to limit number of number of categories displayed by categories widget
- Translate slug in WPMU with PO files
- WordPress daily cron is executing more frequently than once a day
- wp-cron and execution of code in is_admin() included script
- How to Trigger WP CRON at Local Timestamp?
- WP Cron being triggered but not working as expected
- wp_schedule_event() set daily, but processed every second
- Remove all removed pages from wordpress
- How to get custom post_author?
- Will I get an error if I try unscheduling a WP Cron scheduled task that wasn’t scheduled?
- Looking for a better way to initiate cron job
- Multiple array for post_content on plugin activation
- Non editable custom taxonomy
- How to create taxonomy without using register_taxonomy () function
- WordPress plugin cron working only if admin is logged in
- Add location tag to wordpress posts
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How to make a cronjob type plugin
- Plugin to create Posts and Forums then choose category and parent forum
- wp_schedule_single_event is set correctly but sometimes not fired
- Creating posts with links from a txt file
- Using wp_mail to send email?
- How to show comments from different Plugins to same post type?
- How to check if `comment_meta` exists before inserting the comment?
- How to get the `comment_post_ID`?
- Posts form with AJAX request – Plugin development
- Custom plugin foreach wp_insert_post not working
- How to Run Plugin on Server Without Web Browser
- get the term_id of current taxonomy page
- Sanitize WordPress Array Input?
- How to limit number of category term display in home page grids?
- delete category on plugin deactivation wordpress
- How to prevent wp_insert_post from creating a new post every second?
- Plugin with functions inside a class & how to trigger WP CRON
- set a custom post type to a taxonomy term programmatically in metabox
- Custom recurrence not working / Wp Cron event
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Getting duplicate page when activating my plugin
- WP Cron as Fast as WordPress AJAX?
- add_action priority and taxonomy used in plugin
- Detect each active instance of a widget
- Access WordPress Tag Function From Modal
- What method should I use to store my plugin data (multi level menus with options on each item)
- What is the use of wp_schedule_event hook?
- How to display custom taxonomy and terms using/creating plugin template
- Can wp_schedule_single_event be used to run background proccess?
- Add Page With Parent ID
- Yet another wp_insert_post infinite loop. What is wrong?
- Call do_action() within WordPress cronjob
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- wp cron does not run when i am not logged in to wp admin
- Elementor Fatal error: Class ‘Elementor\Widget_Base’ not found
- Headers already sent error with CSV export plugin
- Using wp_filesystem in Plugins to store customizer settings
- Can I use the different settings sections over different pages using the save options group?
- Woocommerce custom emails without header and footer
- Check and load class of theme from a plugin
- What is the proper way to include Bootstrap when executing a shortcode
- How dynamic action login_form_{action} is working
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- Cannot get jQuery UI to enqueue in my plugin!
- How to replace settings in WordPress plugin from a theme
- Is it possible to use the MySQL’s ORDER BY FIELD() clause as part of the pre_get_posts hook?
- Anyway to prevent admin from seeing other admin’s product?
- Build a dynamic block using the default attributes
- How to display .ptm file in my WP site without JAVA
- Programmatically creating posts based on external JSON feed (asynchronously)
- Bulk post approval and publishing doesn’t work
- Show Admin Menu
- How to replace content of a block in and re-render on change?
- extending a core block doesn’t work inside the editor
- register_activation_hook doesn’t execute without add_action(‘init’,’some-function’)
- Getting similar posts by custom field value
- Does WP REST API cache internally executed (rest_do_request) requests?
- Trouble Importing whatsapp-web.js in a WordPress Plugin Development
- ‘useSate’ error when using React on the frontend in custom block plugin
- Display months on a drop down calendar as TEXT instead of Numbers