I've built a class which creates admin pages with the Settings API. I'm trying to optimize it to run only where I need it.
But doing it this way creates the class on every page load. The plugin I'm working on is strictly backend.
Now, I can wrap my
new MyPluginNameClass() call in an
is_admin() conditional to keep it from running on the frontend. But my conditional would still run on every page view, it just exits very quickly on frontend pages.
It just feels wrong to run code on every page when I don't need to. Is there an admin-only hook that I should tie my class instantiation to? Or am I just overthinking this by trying to optimize to save nanoseconds?