set_transient calls should have expiration to prevent autoloading
This commit is contained in:
parent
9a3b796bf4
commit
47e8a76488
|
@ -990,7 +990,7 @@ class WC_Product {
|
|||
|
||||
}
|
||||
|
||||
set_transient( 'wc_average_rating_' . $this->id, $average_rating );
|
||||
set_transient( 'wc_average_rating_' . $this->id, $average_rating, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $average_rating;
|
||||
|
@ -1016,7 +1016,7 @@ class WC_Product {
|
|||
AND meta_value > 0
|
||||
", $this->id ) );
|
||||
|
||||
set_transient( 'wc_rating_count_' . $this->id, $count );
|
||||
set_transient( 'wc_rating_count_' . $this->id, $count, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $count;
|
||||
|
|
|
@ -55,7 +55,7 @@ class WC_Cache_Helper {
|
|||
if ( ! is_null( $account_page ) )
|
||||
$wc_page_uris[] = '/' . $account_page->post_name;
|
||||
|
||||
set_transient( 'woocommerce_cache_excluded_uris', $wc_page_uris );
|
||||
set_transient( 'woocommerce_cache_excluded_uris', $wc_page_uris, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
if ( is_array( $wc_page_uris ) )
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Product_Grouped extends WC_Product {
|
|||
}
|
||||
}
|
||||
|
||||
set_transient( $transient_name, $this->total_stock );
|
||||
set_transient( $transient_name, $this->total_stock, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class WC_Product_Grouped extends WC_Product {
|
|||
|
||||
$this->children = get_posts( 'post_parent=' . $this->id . '&post_type=product&orderby=menu_order&order=ASC&fields=ids&post_status=publish&numberposts=-1' );
|
||||
|
||||
set_transient( $transient_name, $this->children );
|
||||
set_transient( $transient_name, $this->children, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
}
|
||||
}
|
||||
|
||||
set_transient( $transient_name, $this->total_stock );
|
||||
set_transient( $transient_name, $this->total_stock, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
return apply_filters( 'woocommerce_stock_amount', $this->total_stock );
|
||||
|
@ -107,7 +107,7 @@ class WC_Product_Variable extends WC_Product {
|
|||
|
||||
$this->children = get_posts( 'post_parent=' . $this->id . '&post_type=product_variation&orderby=menu_order&order=ASC&fields=ids&post_status=any&numberposts=-1' );
|
||||
|
||||
set_transient( $transient_name, $this->children );
|
||||
set_transient( $transient_name, $this->children, DAY_IN_SECONDS );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ class WC_Query {
|
|||
)
|
||||
);
|
||||
|
||||
set_transient( $transient_name, $unfiltered_product_ids );
|
||||
set_transient( $transient_name, $unfiltered_product_ids, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
// Store the variable
|
||||
|
|
|
@ -25,7 +25,7 @@ function wc_get_attribute_taxonomies() {
|
|||
|
||||
$attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies" );
|
||||
|
||||
set_transient( $transient_name, $attribute_taxonomies );
|
||||
set_transient( $transient_name, $attribute_taxonomies, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_attribute_taxonomies', $attribute_taxonomies );
|
||||
|
|
|
@ -319,7 +319,7 @@ function wc_processing_order_count() {
|
|||
}
|
||||
}
|
||||
$order_count = apply_filters( 'woocommerce_admin_menu_count', intval( $order_count ) );
|
||||
set_transient( 'woocommerce_processing_order_count', $order_count );
|
||||
set_transient( 'woocommerce_processing_order_count', $order_count, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $order_count;
|
||||
|
|
|
@ -163,7 +163,7 @@ function wc_get_product_ids_on_sale() {
|
|||
|
||||
$product_ids_on_sale = array_unique( array_map( 'absint', array_merge( wp_list_pluck( $on_sale_posts, 'ID' ), array_diff( wp_list_pluck( $on_sale_posts, 'post_parent' ), array( 0 ) ) ) ) );
|
||||
|
||||
set_transient( 'wc_products_onsale', $product_ids_on_sale );
|
||||
set_transient( 'wc_products_onsale', $product_ids_on_sale, DAY_IN_SECONDS );
|
||||
|
||||
return $product_ids_on_sale;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ function wc_get_featured_product_ids() {
|
|||
$parent_ids = array_values( $featured );
|
||||
$featured_product_ids = array_unique( array_merge( $product_ids, $parent_ids ) );
|
||||
|
||||
set_transient( 'wc_featured_products', $featured_product_ids );
|
||||
set_transient( 'wc_featured_products', $featured_product_ids, DAY_IN_SECONDS );
|
||||
|
||||
return $featured_product_ids;
|
||||
}
|
||||
|
|
|
@ -1362,7 +1362,7 @@ if ( ! function_exists( 'woocommerce_products_will_display' ) ) {
|
|||
}
|
||||
}
|
||||
|
||||
set_transient( 'wc_products_will_display_' . $parent_id, $products_will_display );
|
||||
set_transient( 'wc_products_will_display_' . $parent_id, $products_will_display, DAY_IN_SECONDS );
|
||||
|
||||
return $products_will_display;
|
||||
}
|
||||
|
|
|
@ -524,7 +524,7 @@ function wc_change_term_counts( $terms, $taxonomies, $args ) {
|
|||
|
||||
// Update transient
|
||||
if ( $term_counts != $o_term_counts )
|
||||
set_transient( 'wc_term_counts', $term_counts );
|
||||
set_transient( 'wc_term_counts', $term_counts, DAY_IN_SECONDS );
|
||||
|
||||
return $terms;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
|
|||
|
||||
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
||||
|
||||
set_transient( $transient_name, $_products_in_term );
|
||||
set_transient( $transient_name, $_products_in_term, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
$option_is_set = ( isset( $_chosen_attributes[ $taxonomy ] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) );
|
||||
|
|
Loading…
Reference in New Issue