Hi @gijo !
Thanks for the quick reply!
Sorry about the delay ( wp emails were going to spam ?? )
I’ve tried the above and other methods alike before submitting this request. What I mean is (and I just confirmed again before this comment) that…
if (current_user_can('administrator')) { add_action('wp_enqueue_scripts', 'flying_pages_enqueue_scripts'); }
returns…
Fatal error: Uncaught Error: Call to undefined function wp_get_current_user()
I tried wrapping the condition inside function flying_pages_enqueue_scripts()
but nothing worked there for me either.
So then I submitted this request.
The use case is fairly simple for 2 reasons.
1. As an admin I don’t need to hover over links and trigger a full page loading.
– Example: I am testing out my menus and when hovering I end up loading 3 page requests when I have no intention to- and do so multiple times for as long as I am developing the menus. The same goes a little for buttons and such. So I would like to disable it for the administrator role specifically.
2. With Litespeed Cache plugin (on Litespeed server) and Beaver Builder it got a little funky in terms of showing the new cached data. Not too sure about that, but alike, in a a page builder- one like the Oxygen Builder @ https://oxygenbuilder.com – Flying Pages would load pages in the editor from the hover that are not even clickable because clicks to other pages in the editor are disabled. That issue could be the same in other page/web builders as a logical guess I think?
So having it disabled for administrator role as a selectable option in the backend would be great.
The code is simple and nice of Flying Pages, and I would have added it myself and submitted like a push to you, but I could not get the condition for the script to work and I couldn’t keep spending time on it. So I’ve just disabled it for now until I can look at it later.