how to exclude wps-hide-login url from preloading?
-
Hey support,
I added code snippets to preload all the stylesheets using rel=”preload” hints. Now how to exclude the custom login URL I createdfunction 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)
Viewing 1 replies (of 1 total)
- The topic ‘how to exclude wps-hide-login url from preloading?’ is closed to new replies.