Remove Admin Notice on page refresh

This is done by wp_admin_canonical_url:

  • It calls wp_removable_query_args to fetch a list of query string parameters to remove, which includes settings-updated.
  • It then writes some script into the page header to use window.history.replaceState to remove the query string from your browser’s URL bar.

    <link id="wp-admin-canonical" rel="canonical"
          href="http://example.com/wp-admin/admin.php?page=xyz">
    <script>
        if ( window.history.replaceState ) {
            window.history.replaceState( null, null,
                document.getElementById( 'wp-admin-canonical' ).href +
                    window.location.hash );
        }
    </script>
    

If you want to add your own arguments to the list that gets removed then you can hook removable_query_args.