wpseo_split_shared_term()Yoast 1.0

Makes sure the taxonomy meta is updated when a taxonomy term is split.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpseo_split_shared_term( $old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy );
$old_term_id(строка) (обязательный)
Old term id of the taxonomy term that was splitted.
$new_term_id(строка) (обязательный)
New term id of the taxonomy term that was splitted.
$term_taxonomy_id(строка) (обязательный)
Term taxonomy id for the taxonomy that was affected.
$taxonomy(строка) (обязательный)
The taxonomy that the taxonomy term was splitted for.

Код wpseo_split_shared_term() Yoast 22.3

function wpseo_split_shared_term( $old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
	$tax_meta = get_option( 'wpseo_taxonomy_meta', [] );

	if ( ! empty( $tax_meta[ $taxonomy ][ $old_term_id ] ) ) {
		$tax_meta[ $taxonomy ][ $new_term_id ] = $tax_meta[ $taxonomy ][ $old_term_id ];
		unset( $tax_meta[ $taxonomy ][ $old_term_id ] );
		update_option( 'wpseo_taxonomy_meta', $tax_meta );
	}
}