add_option_page capability behaving strange

admin_init is called after wp-admin/menu.php is included, so the access check has already been executed and the admin_menu action has fired by the time you execute test_options(). Remove the admin_init hook and call test_options() directly, or find another way of structuring your code so that the admin_menu hook is set up correctly.

You might think it could work because you see the menu option when you are on other pages. This is because the menu is drawn after the page access is checked:

The menu is drawn in:

The access check however is done in:

You see that adding menu items in admin_init is OK to be included in the drawn menu, but too late for the access check. That’s your current situation, and you need to change that by adding the page in the admin_menu hook or earlier.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)