• I’ve been struggling for hours to find some guidance as to how to make the Choices Callback work, I don’t know how to populate the defined field. I found how to do the function at https://www.snip2code.com/Snippet/1669213/Example-Callback-function-for-Ultimate-M/, but when I add getCities() to the Choices Callback field in the editor, it says I must still add edit choices, so I can’t continue.

    What are the steps to populate the field, what should be in the
    Choices Callback and Edit Choices fields in the editor when my function’s name is getCities() in functions.php?

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

    (@meneeroom)

    I found a solution by trying 1mil things.

    The WP Backend Field must look like this:

    The Edit Choices field can’t be empty (this is definitely a bug), so you have to put something in there like an *.

    Then, in the Choices Callback field, you must add your PHP function name, with no brackets. Ie, if your PHP function in functions.php is function getCities(){...}, the field must contain only getCities.

    Thanks for putting the solution to your problem. That is very helpful. I am just starting to work with callback choices and you just saved me major future headaches. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Please explain ‘Choices Callback’’ is closed to new replies.