Support

Account

Home Forums Backend Issues (wp-admin) Custom Fields not showing up when setting taxomony location rules

Solved

Custom Fields not showing up when setting taxomony location rules

  • Hi,

    i have a CPT “Events”.

    This CPT has a custom taxonomy “year”.
    This taxonomy has several terms like 2014, 2015, etc.

    Now lets say i have custom field groups, Event Info 2014, Event Info 2015.

    Each of these should only show up when the event has the taxonomy term attached to it.
    For example, Event Info 2014 should be only visible when the CPT has the 2014 term.

    That is possible by setting up locations rules “Post taxonomy is equal to 2014” and “Post type is equal to Events”

    All this worked for me up to now.

    But i decided to update to acf 5 and for some reason the “Post taxomy is equal to ___” Rule does not work anymore. When i set it up there are no fields attached to the Events edit screen. Once i remove it, the fields appear.

    One thing i should mention, the custom taxonmy is registered to multiple cpts.
    Like this:

    register_taxonomy( 'year', array('events', 'participants','gallery'), $args );

    Any help is appreciated.

  • Well, after doing some testing pretty sure I know why it’s happening and I’ll see if I can get Elliot to take a look at this, but I’m not sure there is anything that can be done, that’ll be up to E.

    With the a term slug of something like ‘2014’ it’s being considered numeric and trying to find the term by id rather than by name.

    On line 32f of location.php

    $field = is_numeric( $data['term'] ) ? 'id' : 'slug';

    causes a numeric term slug to be considered an id.

  • Hi @n1smo

    Thanks for the bug report.
    I’ve just fixed the issue, and now numeric term slugs will work as expected!

    I’ll include this in the next version

    @hube2 thanks mate, great debugging!

  • Great, thanks four your help guys!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.