Outil de recherche WordPress pour les développeurs et auteurs de thèmes



_wp_check_split_default_terms ›

Depuis4.2.0
Dépréciéen/a
_wp_check_split_default_terms ( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy )
Paramètres: (4)
  • (int) $term_id ID of the formerly shared term.
    Requis: Oui
  • (int) $new_term_id ID of the new term created for the $term_taxonomy_id.
    Requis: Oui
  • (int) $term_taxonomy_id ID for the term_taxonomy row affected by the split.
    Requis: Oui
  • (string) $taxonomy Taxonomy for the split term.
    Requis: Oui
Défini(e) dans:
Codex:

Check default categories when a term gets split to see if any of them need to be updated.



Source

function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
	if ( 'category' !== $taxonomy ) {
		return;
	}

	foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) {
		if ( $term_id === (int) get_option( $option, -1 ) ) {
			update_option( $option, $new_term_id );
		}
	}
}