• Resolved GeneralReason

    (@generalreason)


    I am having problems reflecting tax terms used to tag other taxonomy terms in Admin columns; I seem to only be able to return the term ID, not its name.
    Note: I am using Admin Columns Pro to display this column field; Advanced Custom Fields does not do it automatically.

    For example: My taxonomy could be Animals; so terms could be: dog, cat, mouse.. etc. I create a separate taxonomy called Gender to use to tag these animals. Hence terms would be male, female. I then use ACF to create a custom field called ‘gender’ to show up for Animal term types edit pages. After tagging Animal terms with Gender terms, the admin columns of taxonomy Animals is not able to return the Gender term object (term name) it only returns the term ID.

    ACF’s ‘gender’ custom field setting’s would include Field Type set to ‘Taxonomy’, Taxonomy set to gender & input field type set to single input. Toggling between Return Value as Term Object or Term ID or selecting “Load value based on the post’s terms and update the post’s terms on save” also doesn’t change the outcome of the column field value returned.

    Admin Column settings of Animals custom field settings would include Custom Field set to ACFs custom ‘gender’ field + Field Type set to Default. I have tried alternating Field Type settings through ‘Term Name (Term ID’s)’, ‘Default’, ‘Post Title (Post ID’s)’ & Multiple Values -none of them are allowing column field to return correct term object value.

    Anyone else having similar concerns? I am suspecting Admin Column is displaying the value incorrectly. Any Ideas, suggestions?

    https://wordpress.org/plugins/codepress-admin-columns/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter GeneralReason

    (@generalreason)

    Looks like ACF only saves the taxonomy field as the term ID in the database and processes it when it needs to later; hence only the term ID will ever be returned.

    Admin Column is also not able to return the term object name; saved as an input for the custom field.

    Is this an ACF or Admin Column’s limitation then? Unless for debugging purposes why would a user want an ID value returned as a term in an admin column anyway? Wouldn’t it be more useful if we could just return the object value as well? 🙂

    Is there a hook to modify the returned data? That way one should be able to use the get_term_by() function to get the term object?

    Plugin Author Stefan van den Dungen Gronovius

    (@dungengronovius)

    Hi

    The custom field column (which I think you use) only shows you the actual value in the database. Because meta fields can contain any type of contents, we cannot do much formatting for this.

    In your case and for ACF users, we’ve created a specific ACF addon for Admin Columns Pro. This addon is only available for Admin Columns Pro (https://www.admincolumns.com/advanced-custom-fields-columns/) This plugin does exactly what you want. Based on the ACF field, we know what kind of information we must show, based on the custom field.

    I think it is great the ACF just stores the ID. With their get_field() function, you’ll get the desired return value, based on the field. So it is not really a limitation of ACF nor Admin Columns. In our Addon we just make use of the ACF function to show you the correct value in the columns.

    If you want to manipulate the value yourself without the Pro version, you can have a look at this page for the most relevant filters
    https://www.admincolumns.com/documentation/filter-reference/cac-column-value/
    https://www.admincolumns.com/documentation/filter-reference/cac-column-meta-value/

    Thread Starter GeneralReason

    (@generalreason)

    Thank you for the reply and the heads up on the ‘Advanced Custom Fields columns add-on’; it does look like what I need.
    I’m I correct when I see that its at least $119 just to take advantage of this add-on?!

    Plugin Author Stefan van den Dungen Gronovius

    (@dungengronovius)

    Yes that is correct. You’ll need the business license to get the advantages from the ACF addon. But the pro also comes with some very nice other features like Sorting, Filtering, Inline Edit and even multiple sets of columns for your overview.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Field column created for Taxonomy returning Term ID only’ is closed to new replies.