Skip to content

Instantly share code, notes, and snippets.

lw-na / functions.php
Created Aug 27, 2020 — forked from alexander-young/functions.php
Defer Javascript in WordPress
View functions.php
function defer_parsing_of_js($url)
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
lw-na / basic-dropdown-usage.php
Created May 12, 2020 — forked from joshuadavidnelson/basic-dropdown-usage.php
Filter wp_dropdown_categories by post type.
View basic-dropdown-usage.php
* Using wp_dropdown_categories with the post type filter applied.
* @link
// Taxonomy dropdown arguments
$args = array(
'taxonomy' => 'department',
You can’t perform that action at this time.