Jake Vanderwerf
2026-01-01 2bb9aaaf24b794b528e3894ee9f9c42ca6d7fe93
inc/managers/TaxonomyRelationships.php
@@ -4,6 +4,7 @@
use JVBase\JVB;
use JVBase\managers\CacheManager;
use WP_Error;
use WP_Post;
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
@@ -42,8 +43,8 @@
     */
    public function init():void
    {
        add_action('save_post', [$this, 'updatePostRelationships']);
        add_action('before_delete_post', [$this, 'updatePostRelationships']);
        add_action('save_post', [$this, 'updatePostRelationships'], 10, 2);
        add_action('before_delete_post', [$this, 'updatePostRelationships'], 10, 2);
        add_action('delete_term', [$this, 'deleteTermRelationships']);
        add_filter(BASE.'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
@@ -57,13 +58,13 @@
     *
     * @return void
     */
    public function updatePostRelationships(int $post_id):void
    public function updatePostRelationships(int $post_id, WP_Post $post):void
    {
        $this->cache->invalidate();
        $post_type = get_post_type($post_id);
      if (in_array($post_type, [BASE.'directory', BASE.'dash'])) {
      $post_type = $post->post_type;
      if (in_array($post_type, jvbIgnoredPostTypes())) {
         return;
      }
        $this->cache->invalidate();
        // Get all taxonomies for this post type
        $taxonomies = get_object_taxonomies($post_type);