0

I've tried to add a pretty basic test case based on a tutorial by creating a custom settings field in the general options page in the admin area. Problem is the settings field is not showing up, nor any error, just nothing. So no idea how to track down the cause of the no show. :/

function initialize_my_theme_options() {
    //define the settings field
    add_settings_field(
        'my_message',               //The ID
        'My Greeting Message',         // the label for field
        'my_message_display',  //The callback function
        'general'                       //the page
    );

    //register the footer_message setting the general section
    register_setting(
        'general',
        'my_message'
    );
}
add_action('admin_init','initialize_my_theme_options');


function my_message_display() {
    echo '<input type="text" name="my_message" id="my_message" value="" />';
}
1

I have tested your code and it is working fine. I hope you are checking the field on the right place. It should be and it is under Settings > General in your WordPress admin

enter image description here

Just used the given code

  • Thanks for testing... Makes things even more odd. :/ and yes i've looked on the correct options page. which wp version are you using? 4.1? – rpk Jan 7 '15 at 12:37
  • Yes, I tested this on 4.1 – Varun Kumar Jan 7 '15 at 13:10
  • Strange... i've tested it on 4.1 too... No idea why it is working in your setup and mine is failing :/ – rpk Jan 7 '15 at 16:11
  • Have you tried this in a fresh installation? – Varun Kumar Jan 7 '15 at 16:16
  • Yep. Complete fresh install out of the box. – rpk Jan 7 '15 at 17:09

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.