How to run a function when a settings page saves with metabox.io

Sometimes, you need to run a function when you save a metabox settings page. Here’s how:

add_action( 'mb_settings_page_load', function() {
    // Run your code.
    }, 20 );

Example: Flush the Redis Page Cache on Settings Save:

//flush cache on link update
add_action( 'mb_settings_page_load', function() {
    if ( class_exists( '\Nginx_Helper' ) ) { 
        global $nginx_purger; $nginx_purger->purge_all(); 
        }
    }, 20 );