• Resolved kayjayone

    (@kayjayone)


    Using the following code for the custom checkbox to save an array of values. When the [] is left off after the name field for the checkbox everything works, when it’s added back to save the value as an array it does not work. This same code use to work, I’ve made changes to the site but not sure which caused it not to work. I’ve disabled all plugins and reverted any changes I could think of, to no avail. Any ideas…?

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kayjayone

    (@kayjayone)

    code from pastebin…

    http://pastebin.com/qqqnjkpD

    Thread Starter kayjayone

    (@kayjayone)

    After a few days of working on this, posted the problem, then came up with the answer…

    Updated the following from…

    if ( isset( $_POST[ $this->prefix . $customField['name'] ] ) && trim( $_POST[
    $this->prefix . $customField['name'] ] ) )

    To…
    if ( isset( $_POST[ $this->prefix . $customField['name'] ] ) )

    Removing the trim seemed to fix the issue in case this can help anyone.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Admin custom checkbox array not saving to the database’ is closed to new replies.