function axiom_taxonomy_save_custom_fields($term_id = 0) { global $AXIOM_GLOBALS; // verify nonce if (!isset($_POST['meta_box_taxonomy_nonce']) || !wp_verify_nonce($_POST['meta_box_taxonomy_nonce'], basename(__FILE__))) { return $term_id; } $tax_type = isset($_POST['meta_box_taxonomy_type']) ? $_POST['meta_box_taxonomy_type'] : 'category'; $override_key = axiom_get_override_key($tax_type, 'taxonomy'); $custom_options = axiom_taxonomy_load_custom_options($term_id, $tax_type); if (axiom_options_merge_new_values($AXIOM_GLOBALS['options'], $custom_options, $_POST, 'save', $override_key)) { axiom_taxonomy_save_custom_options($term_id, $tax_type, $custom_options); } }
function axiom_get_parent_taxonomy_by_property($id, $prop, $values, $highest = true, $taxonomy = 'category') { if ((int) $id == 0) { $tax = get_term_by('slug', $id, $taxonomy, OBJECT); $id = $tax->term_id; } if (!is_array($values)) { $values = array($values); } $val = $id; do { if ($props = axiom_taxonomy_load_custom_options($id, $taxonomy)) { if (isset($props[$prop]) && !empty($props[$prop]) && in_array($props[$prop], $values)) { $val = $id; if (!$highest) { break; } } } $tax = get_term_by('id', $id, $taxonomy, OBJECT); $id = $tax->parent; } while ($id); return $val; }