Try changing this line
wp_set_object_terms( $post_id, array($cat_ids), 'categorycourses', false);
to
wp_set_object_terms( $post_id, $cat_ids, 'categorycourses', false);
$cat_ids
is already an array and you are writing with in array again.
Hope it helps.
Related Posts:
- Prevent duplicate posts in wp_insert_post using custom fields
- Remove custom posts that match taxonomy value
- Using Custom Posts with Metaboxes and Drop-downs
- How to display data in archive page?
- Set terms in a custom post
- Get posts of ONE taxonomy term of custom post type
- Duplicate Custom Post Type and Taxonomy Slug
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- relating business and products with custom taxonomy?
- How To Use Custom Tax of a Post Type
- How to output all taxonomy links from a custom post type in a menu?
- Show post count in custom taxonomy page
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Multiple Custom Post Type loop logic
- How to list all names and descriptions of a custom taxonomy
- 404 for some custom taxonomy not ALL taxonomy
- Special Query: Title, Terms, Content – %LIKE%
- Taxonomy Category category.php not working
- Attaching taxonomy data to post with wp_insert_post
- Where does WordPress store the users customization in the theme
- Create posts on user registration
- Add a checkbox to post screen that adds a class to the title
- delete post also attachments
- Attach pdf file to custom post type
- How do I create a featured post within a custom post type?
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- Add custom field to category of custom post type
- get_terms parent for current product only
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- generate unique slug while inserting post
- user contributed content as custom post types
- Redirection to taxonomy posts list after post submit.
- Custom Theme Want To Remove One Category From All Displays
- wp_insert_post works, but the post isn’t visible in the admin post list or front end
- Post Type Label Name
- wp_query ‘s’ parameter does not work with custom post type
- Avoid duplicate post from same Taxonomy
- Blog Posts in Custom Menu
- Email Post Attachment on wp_insert_post Action
- I want to display custom text widgets for each post in the sidebar?
- Setting posts_per_page for taxonomy term template
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- CPT archive redirects to single post
- Prevent Delete Attachment by URL or When Submit
- Turn On Comments On Custom Post Types in Directory Theme
- Calling Different Custom Post Timestamps in a table
- How to allow visitors to filter posts by multiple taxonomies
- How to include my own css in post
- Dynamically switch template on click
- post category in wp_insert_post
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Customize rel=canonical tag for single blog post
- disable Tab post on nav-menus page (Admin)
- Tell WP to use a specific template file in posts
- Best Way to Add UnEditable HTML to Posts
- How safe is it to delete old posts edits to save database space?
- Is codex right on deleting post?
- if in category but only with post meta
- How to get different Related Posts
- Custom home page with full post for first one only
- l accidentally permanently deleted a Draft. There’s any way I can recover it?
- Inserting an example of the last 3 post on to the homepage
- Get a term each custom post type
- Getting post and attached image from subdomain
- Custom post type slideshow background images to insert in a plugin
- Help on conditional statement to accompany wp_insert_post function please?
- How to associate a custom taxonomy to a post multiple times
- How to let a user create a post by submitting a POST form?
- Search results for ACF data
- Redirect to custom post if custom archive page has just one result?
- Added a ACF field to custom page and want the results to show as a column in admin
- Template for displaying CPT / Taxonomy URL issues
- Multiple posts in one page
- delete post hook not being fired when deling in wordpress dashboard admin
- WordPress Delete Users from backend doesn’t work
- Is it possible to make a custom post that adds multiple pages?
- Slug collision between page, taxonomy and custom post type
- Hiding title of selected post without plugins
- Custom post styling per category?
- How to use Categories of custom post type
- Hook To Get All Posts Deleted
- Meta boxes not saving
- Custom URL Structure for posts with subcategories
- How to show the posts list into a static page? Problems to use the loop into a static page
- Get new post meta data when (custom) post is saved
- How do I control the fallback query after the original query returned cero posts?
- Allow users to create their own page/s
- Displaying Results From Custom Taxonomy Query
- Multiple loops on a Search result page?
- How can i retrive the movies, trailers, news in a single page using search
- Add default content to post (for specific category)
- WordPress strips some attributes for author posts
- Automatically delete default posts and pages on theme install?
- Display one post randomly from category on home page
- Deleting first four characters from all Post Titles
- Deleling wordpress posts permanently still have IDs
- Post’s arent displaying
- Can I get custom post items in select box (dropdown)
- How to have 2 posting pages on a blog
- Notify/check if the content of a custom gutenberg block has changed on save_post