tried this, but seems to not work as expected.
I copied and pasted your code, and it works for me as expected.
In what way is it working that’s not expected?
(The only thing I can think of why the code may not be working at all is if your theme is not calling wp_footer
.)
work so good (but just for all) with simply:
add_action('wp_footer', 'insert_js_into_footer');
function insert_js_into_footer() {
#if ( ! current_user_can('administrator')) {
?>
<!-- my code -->
<?php
#}
}
without # simply I can’t see (both for guest in private browser and by admin).
anytime flush litespeed cache but issue remain.
It works fine for me – but without any cache plugin. I suspect that this is the problem for you. Or perhaps another plugin that is interfering with the check. Try deactivating it to find the culprit.
ty. after some test, I think is an issue with incognito mode here in Firefox mobile. I see code like from logged user (I search for login widget and I seen my name also if apparently I’m absolutely not logged in). Maybe an issue with view source plugin. Tomorrow I check from desktop. Ty