-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about is_admin #585
Comments
The hook admin_enqueue_scripts will only run on admin anyway so the is_admin() is a pointless check. The hook enqueue_scripts does the opposite and will only run on the front end. |
yes it's true, but a lot of unused action and hooks can be added, what if we change this part of code :
to this :
So we don't run create a new instance of admin class and we don't add non necessary admin hooks and filters to public pages. |
Most actions and filters that you will use inside |
I was looking at the code, asked myself, isn't it better to wrap admin hooks in is_admin() ?
for example in this code :
If wrap inside code in a
if (is_admin()) {}
so we don't run administrative hooks when non-admin pages and posts are loaded?The text was updated successfully, but these errors were encountered: