This my code:

$array_theme_options = array(
        'id' => 'facebook_url',
        'title' => 'Facebook Profile Url',
        'callback' => 'display_facebook_element',
        'page' => 'theme-options',
        'type' => 'text'

function input_type($id, $type)
    switch ($type) {
        case 'text':
            $input = '<input type="text" name="' . $id . '" id="facebook_url" value="' . get_option($id) . '" />';
        case 'checkbox':
            $input = '<input type="checkbox" name="' . $id . '" value="1" '.checked(1, get_option($id), true). ' />';
    return $input;

function display_theme_panel_fields()
    global $array_theme_options;
    add_settings_section("section", "All Settings", null, "theme-options");

    foreach ($array_theme_options as $ato) {
        $cf = create_function('$id, $type','return input_type($id, $type);');
        $input_type = $cf($ato['id'], $ato['type']);

        add_settings_field($ato['id'], $ato['title'], $input_type, $ato['page'], "section");
        register_setting("section", $ato['id']);
add_action("admin_init", "display_theme_panel_fields");

And i get this error with input enter image description here

  • What is the function name you blanked out? – s_ha_dum Oct 20 '15 at 14:52

You have not defined a function called display_facebook_element, at least you did not include that in the code posted. Thus, you are getting the error. display_facebook_element isn't a valid callback. It doesn't exist.

  • I'm sorry but I do not understand you I do not use Display_facebook_element because I'm using with Create_function – Rafael Smith Oct 18 '15 at 18:21
  • 1
    Help please, I believe it is a simple solution – Rafael Smith Oct 20 '15 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.