Created
August 27, 2012 15:45
-
-
Save pippinsplugins/3489681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment