function dont_create_terms( $term_into, $tx_name ) {
    
    // Check if term exists, checking both top-level and child
    // taxonomy terms. 
    $term = empty($term_into['parent']) ? term_exists( $term_into['name'], $tx_name, 0 ) : term_exists( $term_into['name'], $tx_name, $term_into['parent'] );

    // Don't allow WP All Import to create the term if it doesn't
    // already exist.
    if ( empty($term) and !is_wp_error($term) ) { 
        return false;
    }

    // If the term already exists assign it.
    return $term_into;

}

add_filter( 'pmxi_single_category', 'dont_create_terms', 10, 2 ); 
Geef een reactie 0