Snippets

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

You are viewing an old version of this snippet. View the current version.
Revised by Michael Visser 2daf627
<?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' );
?>
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.