Snippets

Visser Labs Adding a custom Term Taxonomy-linked export field to the Users export type

Created by Michael Visser last modified
<?php
function custom_woo_ce_extend_user_fields( $fields = array() ) {

	$fields[] = array(
		'name' => 'user_tag',
		'label' => __( 'User Tag', 'woocommerce-exporter' ),
		'hover' => __( 'Custom User field within functions.php' )
	);

	return $fields;

}
add_filter( 'woo_ce_user_fields', 'custom_woo_ce_extend_user_fields' );

function custom_woo_ce_user_extend( $user ) {

	$term_taxonomy = 'user_tag';
	$user->user_tag = woo_ce_get_product_assoc_tags( $user->ID, $term_taxonomy );

	return $user;

}
add_filter( 'woo_ce_user', 'custom_woo_ce_user_extend' );
?>

Comments (0)