Support

Account

Home Forums Add-ons Options Page options page field name length

Solved

options page field name length

  • Just a question, not a bug .

    I was just looking into something else and learned that the option_name field in the WP database is a varchar(64), I was reading about a problem someone else was having that when setting a new option value with a name longer than this would not fail in WP but then you could not retrieve the value because the name of the option you were looking for did not match the stored name.

    Anyway, I immediately thought about the ACF Options Page add-on. I have a habit of using verbose field names and was worried that some of my field names may be too long.

    This problem was from a couple years ago and I can’t find anything recent to figure out if it’s still a problem in WP, but I did dig into the WP code a bit and don’t see anything that would indicate anything has changed.

    Is this something I need to think about when setting up new fields in a field group that will be used on an options page? Or does ACF magically take care of this for me?

    ~ crazy long field name user 😛

  • Answering my own question 2 years later. The option_name field is not 191 characters in WP. Options field names start with options_ or _options_ for the ACF key field which must also be considered. Sub field names do not need to be verbose because they inherit the name of the parent field as well

    
    'options_'.%parent_name.'_'.$row.'_'.$sub_field_name
    

    Nested repeaters look like

    
    'options_'.%parent_name.'_'.$row.'_'.nested_repeater_name.'_'$row.'_'.$sub_field_name
    
  • @hube2 Thanks for posting that clarification! – exactly what I was looking for 🙂

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

The topic ‘options page field name length’ is closed to new replies.