gistfile1.php

// Get the custom field taxonomy selected term ID’s
$field_value = get_custom_field(“outsourcing_partial_type”);

if ( is_array( $field_value ) ) {

foreach ( $field_value as $selected_value ) {
$tax = get_term_by( ‘id’, (int) $selected_value, “outsourcing_partial_type” );
// Set the name of the taxonomy an an item in a new array
$tax_labels[] = $tax->name;
// Or you could just output it in this for loop
echo “

  • ” . $tax->name . “
  • “;
    }

    // $tax_labels is now an array of each term label/caption/name

    // $csv_tax_labels is now a comma separated string of the name ( taxonomyval1, taxonomyval2, taxonomyval3 … )
    $csv_tax_labels = implode( ‘, ‘, $tax_labels );

    }

    gistfile1.php

    // Get the custom field taxonomy selected term ID's
    $field_value = get_custom_field("outsourcing_partial_type");
    
    if ( is_array( $field_value ) ) {
    
        foreach ( $field_value as $selected_value ) {
            $tax           = get_term_by( 'id', (int) $selected_value, "outsourcing_partial_type" );
            // Set the name of the taxonomy an an item in a new array
            $tax_labels[] = $tax->name;
            // Or you could just output it in this for loop
            echo "<li>" . $tax->name . "</li>";
        }
    
        // $tax_labels is now an array of each term label/caption/name
    
    
        // $csv_tax_labels is now a comma separated string of the name ( taxonomyval1, taxonomyval2, taxonomyval3 ... )
        $csv_tax_labels = implode( ', ', $tax_labels );
    
    }
    No comments yet.

    Leave a Reply