Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Save extra taxonomy fields callback function.
- function save_taxonomy_custom_meta( $term_id ) {
- if ( isset( $_POST['term_meta'] ) ) {
- $t_id = $term_id;
- $cat_keys = array_keys( $_POST['term_meta'] );
- $new_meta = array();
- foreach ( $cat_keys as $key ) {
- if ( isset ( $_POST['term_meta'][$key] ) ) {
- $new_meta[$key] = $_POST['term_meta'][$key];
- }
- }
- // Save the option array.
- update_option( "taxonomy_$t_id", $new_meta );
- }
- }
- add_action( 'edited_category', 'save_taxonomy_custom_meta', 10, 2 );
- add_action( 'create_category', 'save_taxonomy_custom_meta', 10, 2 );
Add Comment
Please, Sign In to add comment