$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Custom plugin settings: clicking "save changes" does not display success message|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Custom plugin settings: clicking "save changes" does not display success message

matteradmin9PV0评论

I don't entirely understanding how to save my plugin's settings properly. When I click on the "Save Changes" button it saves data but it does not show any successful like message. Do I need to add an extra function or something else?

My form look like this:

function bdthemes_core_settings_page() { ?>
    <div class="wrap">
        <h1>BdThemes Settings</h1>
        <form method="post" action="options.php">
            <?php
                settings_fields("section");
                do_settings_sections("plugin-options");      
                submit_button(); 
            ?>          
        </form>
    </div>
<?php 
}

I don't entirely understanding how to save my plugin's settings properly. When I click on the "Save Changes" button it saves data but it does not show any successful like message. Do I need to add an extra function or something else?

My form look like this:

function bdthemes_core_settings_page() { ?>
    <div class="wrap">
        <h1>BdThemes Settings</h1>
        <form method="post" action="options.php">
            <?php
                settings_fields("section");
                do_settings_sections("plugin-options");      
                submit_button(); 
            ?>          
        </form>
    </div>
<?php 
}
Share Improve this question edited Aug 24, 2016 at 18:55 Selim Rana asked Aug 24, 2016 at 18:43 Selim RanaSelim Rana 331 silver badge7 bronze badges 2
  • Normally, using the Settings API as you have will cause a default "Settings Saved" message. The problem would be somewhere else in your mark-up, though you could also try writing an explicit custom message via the admin_notices hook. – CK MacLeod Commented Aug 24, 2016 at 23:36
  • @CKMacLeod If one creates a sub menu and posts to options.php from there, it skips the message. – Talha Imam Commented Feb 15, 2021 at 22:54
Add a comment  | 

1 Answer 1

Reset to default 6

I had the same issue as you did, but I found how to fix it in this tutorial:

https://digwp/2016/05/wordpress-admin-notices/

Basically, I had my settings page outside of the Settings menu, so I had to explicitly add settings_errors() to my options page and they started working. :)

Hope that helps.

Post a comment

comment list (0)

  1. No comments so far