Created
December 27, 2021 10:52
-
-
Save Asikur22/a9056c02a8272e7e1b8faa038c355c31 to your computer and use it in GitHub Desktop.
Bulk Add Term Meta
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
/* | |
* Bulk Add Term Meta | |
*/ | |
function theme_create_term_meta( $term_id, $tt_id, $taxonomy ) { | |
if ( $taxonomy == 'rtcl_category' ) { | |
$types = array( 'sell', 'buy', 'rent' ); | |
if ( ! empty( $types ) ) { | |
foreach ( $types as $type ) { | |
add_term_meta( $term_id, '_rtcl_types', $type ); | |
} | |
} | |
} | |
} | |
add_action( 'create_term', 'theme_create_term_meta', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment