clean_object_term_cache example



    $post = get_post( $post );

    if ( ! $post ) {
        return;
    }

    wp_cache_delete( $post->ID, 'posts' );
    wp_cache_delete( $post->ID, 'post_meta' );

    clean_object_term_cache( $post->ID, $post->post_type );

    wp_cache_delete( 'wp_get_archives', 'general' );

    /** * Fires immediately after the given post's cache is cleaned. * * @since 2.5.0 * * @param int $post_id Post ID. * @param WP_Post $post Post object. */
    
$terms = array_merge( $terms, array( $default ) );
            }
        }

        $terms = array_map( 'intval', $terms );
        wp_set_object_terms( $object_id$terms$taxonomy );
    }

    // Clean the relationship caches for all object types using this term.     $tax_object = get_taxonomy( $taxonomy );
    foreach ( $tax_object->object_type as $object_type ) {
        clean_object_term_cache( $object_ids$object_type );
    }

    $term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) );
    foreach ( $term_meta_ids as $mid ) {
        delete_metadata_by_mid( 'term', $mid );
    }

    /** * Fires immediately before a term taxonomy ID is deleted. * * @since 2.9.0 * * @param int $tt_id Term taxonomy ID. */
/** * Deletes the bookmark cache. * * @since 2.7.0 * * @param int $bookmark_id Bookmark ID. */
function clean_bookmark_cache( $bookmark_id ) {
    wp_cache_delete( $bookmark_id, 'bookmark' );
    wp_cache_delete( 'get_bookmarks', 'bookmark' );
    clean_object_term_cache( $bookmark_id, 'link' );
}
Home | Imprint | This part of the site doesn't use cookies.