• Resolved kishorchand

    (@kishorchand)


    Hey support,
    I added code snippets to preload all the stylesheets using rel=”preload” hints. Now how to exclude the custom login URL I created

    function add_rel_preload_tag($html, $handle, $href, $media) {
        // Define an array of excluded pages, including wp-login.php
        $included_pages = array('2448', 'test', 'excluded-page-slug');
    	$excluded_pages = array('7302', 'custom-login', 'excluded-page-slug');
    	
        // Check if the current page is in the excluded pages array or is an admin page
        if (is_admin() && is_page($included_pages) || is_singular('excluded-custom-post-type') || is_page($excluded_pages)) {
            return $html;
        }
    
        $html = <<<EOT
    <link rel='preload' fetchpriority="high" as='style' onload="this.onload=null;this.rel='stylesheet'" id='$handle' href='$href' type='text/css' media='all' />
    EOT;
    
        return $html;
    }
    add_filter( 'style_loader_tag', 'add_rel_preload_tag', 10, 4 );
    

    Thanks
    Kishorchand

Viewing 1 replies (of 1 total)
  • Plugin Support MaximeWPS

    (@seinomedia)

    Hello,

    Thanks for using WPS Hide Login.

    You can use is_login() function and add it to your condition.

Viewing 1 replies (of 1 total)
  • The topic ‘how to exclude wps-hide-login url from preloading?’ is closed to new replies.