It is because you are trying to pass array of string instead of int.
So it search for terms slug with this value instead in terms id.
function remove2categories( $new_status, $old_status, $post ) {
if ( $old_status == 'private' && $new_status == 'publish' && !in_category(array(3152), $post ) ) {
$catsID = array(1186, 1208);
wp_remove_object_terms( $post->ID, $catsID, 'category' );
}
}
add_action( 'transition_post_status', 'remove2categories', 10, 3 );
Related Posts:
- How to add featured image for category (without a plugin)?
- Category archive by year with permalink support /category/YYYY
- Create a category list page
- How do I use the same post slug for different Categories?
- Default WP Gallery – show only galleries of a certain category
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- Woocommerce product categories order [closed]
- How do I create a way for users to assign categories to a post from the frontend?
- Exclude sub category posts from category display
- How to hide a specific category posts in my monthly archive?
- Give specific category its own permalink structure
- Automated adding of one tag to all the posts in a category
- How to set up sub-categories for author pages?
- Assign different category colours to different categories in the main menu
- Deleting All tags except categories Wp database
- Action hooks returning old category instead of new category
- Category checkboxes in upload modal
- wp_list_categories, Add class to all list items with children
- Using separator with wp_list_categories
- How to mass-insert categories?
- Multi-site or categories?
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Custom WP_Query for current category (in category.php)?
- Why is get_the_category() saying that I have two categories?
- View the latest created categories
- Custom sidebar on category pages
- category hierarchy level as a body class – parent cat =1, child cat=2, grandchild=3
- How do I get the category slug from wp_dropdown_categories
- Change the category of all posts in it
- shop page with all categories with paginate
- How to filter out Categories for specific post types on WordPress Admin?
- Limit a meta box to a specific category
- get_posts and multiple categories
- List categories with posts
- Pagination not visible on woocommerce’s category page
- Only one post is showing on category page, why?
- wp_list_categories set order manually?
- Refine/Filter the Search Results by Category
- Putting a Category of posts under a Page
- change recent posts based on category
- category pagination got broken suddenly
- Where and when does WordPress invoke routes
- Getting category URL with hyphens, not spaces
- How can I change the tooltip in the_category?
- Category.php loads first before page.php?
- wp_update_post is not updating category
- How to get Next/previous_post_link to go through articles in top parent category
- What’s wrong with my wp database query?
- WordPress get from single.php back to the right category page
- Fix Warnings that shouldn’t be necessary to fix
- how to get correct category of a post in case of multiple categories?
- Include WooCommerce product to all child categories
- Show button only for certain Woocommerce Product Categories
- get listed category’s id?
- Length of Category Names
- WordPress link to post links to category (loop)
- Display all product tags associated with a specific product category
- Category url generate 404 error
- Is it possible to create an alias/custom taxonomy for a category name?
- Style a category from category list
- Adding a page summary to a specific page
- Add a category on all archive category pages
- what file I need to create to work date archive links?
- Multiple category columns and post counting list in wordpress Homepage
- Assigning certain pages or posts to use the template of the parent page or category
- Check for parent category
- I need advice on how to structure the categories according to the layout i have
- How to get posts using category slug in ClassiPress?
- add current-cat class to single post page
- Problem with wp_create_category
- Assign author to category and not only posts
- Problem with pagination block in Gutenberg
- Product category display in tabs
- Sending all categories associated with a post to Google Ad Manager for use with .setTargeting
- Pull in an “Include” file based on a WordPress Category ID
- How to fetch common posts from two feeds?
- Why is URL Slug Saving Differently From How It’s Been Defined?
- How to set acf color field as background color to product category
- How to add all subcategories as submenu in WordPress menu
- Get permalink to latest post in category
- How to noindex, follow a specific category wordpress?
- Category pages resolving with and without category prefix
- get taxonomy list in a page in the wordpress
- Is there a way to allow users to customize their feed view?
- Number of categories slowing down the site
- Subcategory Page 404ing
- displaying one category on one page
- Ajax Category add doesn’t update the list table custom column
- Question About Messing With Category Pages and Descriptions
- how to get postmeta info based on multiple categories?
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- Group Posts by First Letter of Title categories
- List Terms by category
- How to make 10 post of one category
- Listing category
- Anyway to hide a Category in the Categories section when adding/editing a post in WP Admin?
- Showing one post from each category, paged?
- Custom permalinks structure
- Weird html output of single_cat_title – is not inside of the html element?
- Images as Categories