Global State During an Admin Post

  1. When using admin-post.php, no loaded menus on an admin-post.php request is standard wordpress behavior. Standard practise to redirect after processing done on post action hook is to use: wp_redirect( admin_url( 'admin.php?page=YOUR_PAGE' ) );

  2. When using admin-post.php, wordpress will include wp-admin/includes/wp-admin.php instead of wp-admin/wp-admin.php ( WordPress Admin Bootstrap ) to skip some setup. One of the API call skipped in this included files is menu build files.

    During WordPress Admin Bootstrap, system includes menu.php which eventually fire actions to load and build admin menus. Post action intentionally skipped menu loads processing.

  3. For plugins and forms, post to adin-post.php is considered correct
    and after processing use wp_redirect with admin_url to redirect page
    to original menu item page.

tech