Form submit in admin does not set is_admin() true

Ok, here is what I found out to solve the issue:

First of all, the form should be posted to admin-post.php

2nd, there should be a hidden variable “action”

so the form should be like:

<form method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>">
    <input type="hidden" name="action" value="my_settings_save">
    ....
</form>

Now the is_admin() is true and my admin core file is called successfully.

In that admin core file, I only set this action:

add_action('admin_post_my_settings_save', 'my_settings_save_function');
function my_settings_save_function()
{
    ...
}

and it works like a charm!