Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Robert Schweitzer

Taxonomy Terms inside Repeater showing ID’s

Hi i have a Repeater Field with a Taxonomy Terms Field set to Return Value “Term object”

Unfortunately i see the Terms ID instead of the Term title.

Before AC v7 i had this Hook, but know with your new Version you killed the hook:

function ac_column_value_custom_field_example( $value, $id, AC\Column $column ) {

    $column_name = $column->get_name();

    if( $column_name == '63f4f1f7af5c28' || $column_name == '63f4f238f47ae0' ) {

        $values = str_replace(array('<div class="ac-repeater-divider">', '</div>'), array(',', ''), $value);
        $values_arr = explode(',', $values);

        $value=''; $i=0; $values_length=count($values_arr);
        foreach ($values_arr as $values) {
            $i++;

            $term_name = get_term( $values )->name;
            $div = ( $i < $values_length ) ? '<div class="ac-repeater-divider"></div>' : '';
            $value .= $term_name . $div;

        }

        $value = $value;

    }

    return $value;
}

add_filter( 'ac/column/value', 'ac_column_value_custom_field_example', 10, 3 );
2 weeks, 5 days ago
Stefan van den Dungen Gronovius
Developer

Since version 7, some filters and actions have been renamed.
The hook you’re using can be replaced with the following hook:
https://github.com/codepress/admin-columns-hooks/blob/master/ac-column-render.php

You snippet should no look something like this (untested)

function ac_column_value_usage($value, AC\Setting\Context $context, $id)
{
    $column_name = $context->get_name();

    if( $column_name === '63f4f1f7af5c28' || $column_name === '63f4f238f47ae0' ) {
        $values = str_replace(array('<div class="ac-repeater-divider">', '</div>'), array(',', ''), $value);
        $values_arr = explode(',', $values);

        $value=''; $i=0; $values_length=count($values_arr);
        foreach ($values_arr as $values) {
            $i++;

            $term_name = get_term( $values )->name;
            $div = ( $i < $values_length ) ? '<div class="ac-repeater-divider"></div>' : '';
            $value .= $term_name . $div;

        }
    }

    return $value;
}

add_filter('ac/column/render', 'ac_column_value_usage', 10, 3);
2 weeks, 5 days ago

You must be logged in to reply to this topic.