save_extra_category_fileds

The Woocommerce Category based sitemaps save extra category fileds function.

Description

save_extra_category_fileds( $term_id ); 

Parameters (1)

0. $term_id
The term id.

Usage

  1. if ( !function_exists( 'save_extra_category_fileds' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-category-based-sitemaps/includes/wccs-functions.php'; 
  3.  
  4. // The term id. 
  5. $term_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = save_extra_category_fileds($term_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wccs-functions.php  
  1. function save_extra_category_fileds( $term_id ) { 
  2. if ( isset( $_POST['display_type'] ) ) { 
  3. $t_id = $term_id; 
  4. $cat_meta = get_option( "category_$t_id"); 
  5. $cat_keys = array_keys($_POST['Cat_meta']); 
  6. foreach ($cat_keys as $key) { 
  7. if (isset($_POST['Cat_meta'][$key])) { 
  8. $cat_meta[$key] = $_POST['Cat_meta'][$key]; 
  9.  
  10. update_option( "category_$t_id", $cat_meta );