• Hi, have a custom coded WP theme and my focus is to strip out as much unneeded code as possible and one thing I am noticing is you have the admin bar styles loaded 100% of the time rather than just when a user is logged in.

    This is added uncessarry code / styles to the site when it’s not needed 99% of the time. Is there a function to disable this except for when a user is logged in or just when the admin bar is enabled or can you update the plugin to make this default.

    This is being loaded on every page

    <style>
    #wp-admin-bar-pvc-post-views .pvc-graph-container { padding-top: 6px; padding-bottom: 6px; position: relative; display: block; height: 100%; box-sizing: border-box; }
    #wp-admin-bar-pvc-post-views .pvc-line-graph {
       display: inline-block;
       width: 1px;
       margin-right: 1px;
       background-color: #ccc;
       vertical-align: baseline;
    			}
    			#wp-admin-bar-pvc-post-views .pvc-line-graph:hover { background-color: #eee; }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-0 { height: 1% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-1 { height: 5% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-2 { height: 10% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-3 { height: 15% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-4 { height: 20% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-5 { height: 25% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-6 { height: 30% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-7 { height: 35% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-8 { height: 40% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-9 { height: 45% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-10 { height: 50% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-11 { height: 55% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-12 { height: 60% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-13 { height: 65% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-14 { height: 70% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-15 { height: 75% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-16 { height: 80% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-17 { height: 85% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-18 { height: 90% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-19 { height: 95% }
    			#wp-admin-bar-pvc-post-views .pvc-line-graph-20 { height: 100% }
    		</style>

    Thank you.

    • This topic was modified 2 years, 4 months ago by greenhoe.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Confirm.

    Also, every page loads
    <link rel="stylesheet" href="/plugins/post-views-counter/css/frontend.css">
    where admin bar not applied

    @greenhoe
    You can use that thing to prevent loads PVC styles on front

    add_action( 'wp_print_styles', function() {
        if (current_user_can( 'update_core' )) {
            return;
        }
    
        wp_deregister_style('dashicons');
        wp_deregister_style('post-views-counter-frontend');
    }, 100);

    `

    Sorry, small fix

    if (is_user_logged_in())

    Thread Starter greenhoe

    (@greenhoe)

    @phalcon

    This doesn’t fix the in-line style that i posted above that has the style in-line. I already deregsitered those styles in my functions for their standard css and the in-line style is still showing on all pages for all users.

    So when you view the site the style admin bar style is loaded on the page even for a normal user that isn’t logged in, for what reason would you need to load the admin bar style when a user doesn’t even have access or logged in where they have an admin bar.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Admin Bar Style loading on every page, slowing the site down’ is closed to new replies.