• Line 108, add the following :

    if ( current_user_can( 'manage_options' ) ) {
        		/* A user with admin privileges */'

    BEFORE the closing PHP tag.

    At the NEXT opening PHP tag add the following

    }.

    For ease of use, I have done the following:

    if ( current_user_can( 'manage_options' ) ) {
        		/* A user with admin privileges */
    		?>
    
    		<div id="wp_pls">
    
    <ul>
    <li><?php printf( __( '%s queries in %s seconds.', 'wp_pls' ), $query_count, $timer_stop ); ?></li>
    <li><?php printf( __( 'Average load time of %s (%s runs).', 'wp_pls' ), $average_load_time, sizeof( $load_times ) ); ?></li>
    <li><?php printf( __( '%s out of %s MB (%s) memory used.', 'wp_pls' ), $memory_usage, $memory_limit, round( ( $memory_usage / $memory_limit ), 2 ) * 100 . '%' ); ?></li>
    <li><?php printf( __( 'Peak memory usage %s MB.', 'wp_pls' ), $memory_peak_usage ); ?></li>
    </ul>
    			<div class="actions">
    				<a href="void(0);">×</a>
    				<a>">-</a>
    			</div>
    		</div>
    		<?php
    		} //Nick Edit - The above checks if user is an admin. If they are, shows the stats, if not, it won't.

    https://www.ads-software.com/plugins/wp-page-load-stats/

Viewing 3 replies - 1 through 3 (of 3 total)
  • exactly what i was looking for thx

    Great mod, nickweb!

    Would anyone know how to also add support to NOT display load stats on wp-admin pages?

    Thanks!

    Forget it. This was easy enough. Just update the following row:

    From:
    if ( current_user_can( 'manage_options' ) ) {

    To:
    if ( current_user_can( 'manage_options' ) && ! is_admin() ) {

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enable Admin only viewing’ is closed to new replies.