Support

Account

Home Forums General Issues Use field values from category on edit post page

Solved

Use field values from category on edit post page

  • Hi,
    I have following scenario: I have created repeater field for CATEGORY taxonomy. Through that repeater I’m adding multiple text values, let’s call them KEYS.
    On custom post type, called PRODUCTS, if I choose one of CATEGORIES, I want to display all KEYS given for that category and let the user enter for each KEY its VALUE.
    Example: I have created category Cars and through repeater I have added three text keys: Doors, Engine and Transmission. When I add new product called Volkswagen Golf and set its category as Cars, I want to be able to fill for Doors: 5, Engine: 1.6, Transmission: Manual.

    Any hints what should I use? Metabox for displaying category keys, but how to store values for them?

    Thanks for any input on this.

  • What version of ACF are you using.

  • I’m using newest version (5.4.4) of acf pro.

  • Ok, my solution for now is following: created ACF repeater for taxonomy. Loading it in a loop in custom metabox on edit post page. For each key metabox is creating input with name=field[key], saving all inputs as array metadata into one metakey=>value. Loading works, saving works, displaying also. It’s not really using much of ACF (only repeater for category), but I guess it’s the only way now.
    If anyone has better solution, I would be glad to hear it.

  • The reason I asked is that I have an example of doing something similar. It automatically populates a repeater on a post based on the repeater on the post category. There’s a lot involved, hopefully you will find the code useful https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-repeater-on-category

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

The topic ‘Use field values from category on edit post page’ is closed to new replies.