After doing much more search… it looks like the save_post hook does not run after the post categories are updated so it will only show the categories that the post had before the update (or no categories for new posts).
I found that I need to use this hook and then everything inside my function is updated:
add_action('rest_after_insert_post', 'test' , 10, 2 );
I had no idea that was the hook I needed to use. I hope this helps someone!
Related Posts:
- Hook when category is added to post
- get_categories for custom post type with a specific custom taxonomy attached
- What’s the URL for a category archive?
- Exclude categories from Loop, queries, widgets, post navigation
- how to use a different domain/subdomain for authors/catagories on single site?
- Sticky posts on home page, search, tag and archives without plugin
- WordPress 1 domain multiple blogs
- Category count inside the link
- Is there a way to have duplicate category slugs?
- Multiple level category drop-down
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Name of last category level for a post
- How to add style to category link?
- WordPress Ordering Problem. How to fix ordering 1-10-100 issue?
- Filtering Children of the “uncategorized” Category out of the Loop?
- how to show posts of category random by session
- Remove “Parent” Selection When Adding/Editing Categories?
- Filtering search results
- WooCommerce change category url and product base
- Display products for a category, sorted by post_excerpt
- How can we get Catergory / Term Creator
- Seperate WordPress catagories into sepeat list on seperate pages
- Redirect category to first available child post
- Show post only if match all categories
- How do you bulk remove a category from posts?
- How to get product count with respect to categories in WooComerce
- Password protect a specific category page/post
- conditional for sub category on archive page
- Display WordPress Parent Categories Only?
- Exclude Posts From Specific Category from Next and Previous post links
- How would I go about adding custom header images per category?
- how to query posts and auto assign category if post title has keyword
- I want to display posts common in 3 categories [closed]
- Displaying just one new/current post per category in homepage
- How to Add Default Content for all Category Pages Before and After Content?
- How do I share categories across selected sites in a Multisite setup
- Show popular post by category code
- Drop posts from categories in MySql
- Categories in admin interface: can they be collapsible?
- How to append category name to category ID in a form field
- Category template to show different categories based on parent
- Equivalent to in_category() for subcategories
- query_post order desc
- Limit number of posts on a custom category template – breaking pagination
- list categories based on updated posts [closed]
- How to create a subcategory to a PAGE on WP?
- How can I only display one link rather than many?
- Hierarchical permalink structure for posts showing categories and sub-categories
- how i can hide some category from author admin panel?
- Display posts from a category
- Finding the category id’s on category intersection pages
- how do I use the walker class to display categories in their correct heirarchy?
- Display sibling categories on category page
- Getting the category title / description returns first matching post?
- I want to know how to output child categories related to parent categories
- why get_the_post_thumbnail( the_ID()) echos extra post id
- Allow user to select categories that will display in post loop
- display category list year wise in wordpress
- Echo show_count of categories separately without using wp_list_categories
- Two Sections on Woocommerce Catergory Page [closed]
- How to fetch the highest category in the hierachry for a specific post?
- Woocommerce search form with category select
- Display category title and three latest post inside the category
- Display all sub category but one
- Let user select their own category
- Pagination breaks on child-categories, works fine on parent-category
- Is the part “category” fixed to an URL to an archive or post?
- How can I use AJAX with check-box categories?
- wp_delete_term or wp_delete_category?
- List Categories By Specified First Character
- the category city made as a subdomain
- Category name for all posts getting assigned to a single random post
- Displaying Single Product Page Parent and Child Category
- wp_get_post_categories not work currently on loop.php
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- How to add the .html extension to the category?
- Add filter for specific category only
- How to create category filter on a blog like on the site below?
- Get category base permalink
- Wrong category in URLs accepted like the correct one
- WooCommerce showing active product categories on single product page
- how to exclude specific category types (uncategorized) from blog page?
- Style a category page the same way as the homepage?
- Conditional statement: if is_category, append at the end of page
- How to Manage and link certain custom taxonomy?
- Store All Post Categories In Array
- How to add an “All” category to the tag cloud?
- Display Taxonomies in loop with template args
- How to create an array with category ids order by the one that has the most recent post
- How to assign image on specified category and not show the image on other categories
- Categories Going to different Blog Pages?
- Display only the latest post
- How to structure Multisite sites into categories?
- Change next_post and previous_link to navigate throught parent categories only
- Template files not working for archives and categories
- Multiple Parent Category URLs
- What defines a post as portfolio page content?
- How to add location as category?
- Taxonomy term RestApi data 10 rows limitions
- Replace category titles inside RSS feed