Custom Fields
Support MB Settings Page Do action hook 'mb_settings_page_load' execution only when saved/updated

  • Creator
  • #16039
    Resolved badabingbreda

    Hi, I'm exploring a mechanism in which the settings page(s) are used to write global CSS-styles. I need to clear cache plugin after an update to the settings has been performed.

    I can't seem to find a way to easily determine if an update has been performed. I can hook the callback with a priority 20 or higher, which makes it run after the save, but don't want to run it all the time. I know I can hook into mb_settings_page_load to do some actions after save, but the $args don't tell me there has been an update or initial save action. Maybe I'm missing something, can you point me in the right direction?

Viewing 1 replies (of 1 total)
  • Author
  • #16052
    Anh Tran


    I think you need to track the 'initial save' or 'update' with a custom option, like this:

    add_action( 'mb_settings_page_load', function() {
        $is_updated = get_option( 'your_custom_option' );
        if ( ! $is_updated ) {
            update_option( 'your_custom_option', 1 );
    }, 20 );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.