Is it save to require plugin.php early to be able to use get_plugin_data() earlier?

At first glance it works and I cannot see any implications but maybe you are aware of some? You say that you are not getting errors, which I would have expected but it looks as though WordPress uses require_once() so you are probably safe: 39 /** WordPress Plugin Administration API */ 40 require_once(ABSPATH . ‘wp-admin/includes/plugin.php’); … Read more

Difference between hooks Plugin_loaded and admin_int?

plugins_loaded fires once activated plugins have loaded. This fires on both admin and public screens. admin_init fires as an admin screen or script is being initialized. This fires only on admin screens. The typical order for firing of hooks on the admin screen is: muplugins_loaded – this is the first hook available to must-use plugins … Read more

How do I Enqueue styles/scripts on Certain /wp-admin Pages?

add_menu_page and add_submenu_page both return the page’s “hook suffix”, which can be used to identify the page with certain hooks. As such, you can use that suffix in combination with the variable hooks admin_print_styles-{$hook_suffix} and admin_print_scripts-{$hook_suffix} to specifically target these pages. function my_menu() { $menu = add_menu_page( ‘Page 1’, ‘bar’, ‘something’, ‘else’, ‘foo’ ); $submenu … Read more