The preferred method of creating a settings page is to use the [WordPress Settings API](https://codex.wordpress.org/Settings_API). But from your code example, it looks like it's too late to remove the `admin_notices` hook inside your callback in the `admin_menu` hook. You should try to remove the logic from the `customfunc()` callback into another callback activated from some earlier hook, for example `admin_init`. You are calling the new menu page *settings*, but the user might confuse it with the existing *Settings* page. ps: You should check out the settings API.