Skip to content

Instantly share code, notes, and snippets.

View brianleejackson's full-sized avatar
✍️
Writing

Brian Jackson brianleejackson

✍️
Writing
View GitHub Profile
@brianleejackson
brianleejackson / disable-fetch-priority-gb-mega-menu.php
Created March 5, 2026 20:49
Disable fetch priority on GB mega menu
/**
* Prevent GenerateBlocks from forcing high priority/eager loading in overlays (Mega Menus)
*/
add_filter( 'generateblocks_pro_overlay_allow_lazy_load', '__return_true' );
@brianleejackson
brianleejackson / check-duplicate-scripts.js
Created February 16, 2026 23:16
Check for duplicate scripts on a page using Chrome DevTools
// Paste into Chrome DevTools console
var scripts = document.getElementsByTagName('script');
var srcList = [];
for (var i = 0; i < scripts.length; i++) {
if (scripts[i].src) srcList.push(scripts[i].src.split('?')[0]);
}
var duplicates = srcList.filter((item, index) => srcList.indexOf(item) !== index);
console.log("Duplicate Scripts Found:", duplicates.length ? duplicates : "None!");
@brianleejackson
brianleejackson / move-gp-viewport.php
Created September 18, 2025 18:48
Move GeneratePress viewport up
add_action('template_redirect', function() {
remove_action('wp_head', 'generate_add_viewport', 1);
add_action( 'wp_head', 'generate_add_viewport', 0);
});
@brianleejackson
brianleejackson / disable-application-passwords-wordpress.php
Created June 16, 2025 19:08
Disable application passwords in WordPress
add_filter( 'wp_is_application_passwords_available', '__return_false' );
add_filter( 'wp_theme_json_data_theme', 'disable_inter_font', 100 );
function disable_inter_font( $theme_json ) {
$theme_data = $theme_json->get_data();
$font_data = $theme_data['settings']['typography']['fontFamilies']['theme'] ?? array();
// The font name to be removed
$font_name = 'Inter';
// Check if 'Inter' font exists
foreach ( $font_data as $font_key => $font ) {
if ( isset( $font['name'] ) && $font['name'] === $font_name ) {
// Remove the font
@brianleejackson
brianleejackson / wlwmanifest-link.php
Created May 24, 2024 04:27
Remove wlwmanifest link in WordPress
@brianleejackson
brianleejackson / disable-wordpress-fetch-priority.php
Created December 8, 2023 03:58
Disable WordPress core fetch priority
function disable_fetchpriority_high( $loading_attrs ) {
unset( $loading_attrs['fetchpriority'] );
return $loading_attrs;
}
add_filter(
'wp_get_loading_optimization_attributes',
'disable_fetchpriority_high'
);
@brianleejackson
brianleejackson / divi-cls-fix.js
Last active February 2, 2026 04:09
Fix Divi CLS (make sure to also exclude it from Delay and Defer JS).
<script type="text/javascript">
var elm=document.getElementsByTagName("html")[0];
elm.style.display="none";
document.addEventListener("DOMContentLoaded",function(event) {elm.style.display="block"; });
</script>
<?php
add_action( 'shutdown', function() {
// If the event is scheduled, don't run anything.
if ( wp_next_scheduled( 'prefix_remove_license_activation_logs' ) ) {
return;
}
if ( ! function_exists( 'edd_has_upgrade_completed' ) ) {
@brianleejackson
brianleejackson / fastclick-mobile-only.js
Created March 1, 2023 22:32
Only load FastClick on mobile devices (no tablets or desktop)
<script>
if (window.innerwidth < 900) {
document.write('<script type="text/javascript" src="https://domain.com/wp-content/plugins/perfmatters/vendor/fastclick/fastclick.min.js"><\/script>');
}
</script>
<script>
if(window.innerWidth < 900) {
if('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {