Skip to content

Instantly share code, notes, and snippets.

@Asikur22
Created December 27, 2021 10:52
Show Gist options
  • Save Asikur22/a9056c02a8272e7e1b8faa038c355c31 to your computer and use it in GitHub Desktop.
Save Asikur22/a9056c02a8272e7e1b8faa038c355c31 to your computer and use it in GitHub Desktop.
Bulk Add Term Meta
/*
* 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