The bug was caused because of sloppy code design. Which lead to using too many require
.
Changing
function plugin_setup_menu()
{
$icon_url = PLUGIN_URL . "public/images/dash-icon.png";
add_menu_page(__(PLUGIN_NAME, PLUGIN_SLUG), __(PLUGIN_NAME, PLUGIN_SLUG), 'manage_options', PLUGIN_SLUG, array('views', 'admin'), $icon_url);
}
to
function plugin_setup_menu()
{
$icon_url = PLUGIN_URL . "public/images/dash-icon.png";
add_menu_page(PLUGIN_NAME, PLUGIN_NAME, 'manage_options', PLUGIN_SLUG, array($this,'admin_menu_view'), $icon_url);
}
and adding another method
function admin_menu_view()
{
include_once PLUGIN_PATH . 'views/admin.php';
}
fixed the issue for me.