Skip to content

Commit

Permalink
fix: delete cached category (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Aug 30, 2018
1 parent b1c468b commit 6c924bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,25 +516,6 @@ function dokan_store_category_menu( $seller_id, $title = '' ) {

endif;

/**
* Clear transient once a product is saved or deleted
*
* @param int $post_id
*
* @return void
*/
function dokan_store_category_delete_transient( $post_id ) {

$post_tmp = get_post( $post_id );
$seller_id = $post_tmp->post_author;

//delete store category transient
delete_transient( 'dokan-store-category-'.$seller_id );
}

add_action( 'delete_post', 'dokan_store_category_delete_transient' );
add_action( 'save_post', 'dokan_store_category_delete_transient' );

function dokan_seller_reg_form_fields() {
$postdata = wc_clean( $_POST ); // WPCS: CSRF ok, input var ok.
$role = isset( $postdata['role'] ) ? $postdata['role'] : 'customer';
Expand Down
19 changes: 19 additions & 0 deletions includes/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1072,3 +1072,22 @@ function dokan_bulk_order_status_change() {
}

add_action( 'template_redirect', 'dokan_bulk_order_status_change' );

/**
* Clear transient once a product is saved or deleted
*
* @param int $post_id
*
* @return void
*/
function dokan_store_category_delete_transient( $post_id ) {

$post_tmp = get_post( $post_id );
$seller_id = $post_tmp->post_author;

//delete store category transient
delete_transient( 'dokan-store-category-'.$seller_id );
}

add_action( 'delete_post', 'dokan_store_category_delete_transient' );
add_action( 'save_post', 'dokan_store_category_delete_transient' );

0 comments on commit 6c924bc

Please sign in to comment.