Support

Account

Home Forums Bug Reports Default value for non-applicable posts

Solving

Default value for non-applicable posts

  • I think this one is somewhere between a bug and a feature request 🙂 Right now if you set a field which has a default value and is only shown for posts in category A and you try to retrieve the value for a post in Category B it gives you the default value. I believe it should give you an empty value since the field is not applicable to that post.

    Did that make any sense?

    Daniel

  • Hi @danielpataki

    I think you have stumbles across what looks like a bug, but what is actually correct behavior. The API functions get_field and the_field, will never return the ‘default’ value on the front end, only the value saved to the DB

    If the API is returning the default value, then it must be saved in the DB to that post. Perhaps you first saved the post as Category A, then changed it to B and this left the origional value saved int he DB?

    Thanks
    E

  • Hi Elliot,

    This is definitely a possibility! I will investigate and get back to you here with an answer,

    Daniel

  • Hi Elliot,

    I had a look and I think this is still a bug, I’ve created a hand screencast to explain. Sorry for the weird resolution 🙂

    http://cl.ly/1e23203G2N1e

    Daniel

  • Hi @danielpataki

    Thanks for the simple and easy to understand screencast. I’ll have to do some testing with this one and get back to you.

    Cheers
    E

  • Hi Elliot,

    It was no problem at all! We can of course fix this on our end by adding some code just before we output the meta but it would be nice if the ACF core took care of it.

    As a quick aside, I sent you a screencast about translation stuff a few days ago. On our end this is much more pressing, did you have some time to take a look at it? I think we found a better solution to translate user input 🙂 We actually have a solution, not just a problem 😉

    Daniel

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

The topic ‘Default value for non-applicable posts’ is closed to new replies.