Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ramonfincken/23eab9c8632d82fd230a579cac6777a9 to your computer and use it in GitHub Desktop.
Save ramonfincken/23eab9c8632d82fd230a579cac6777a9 to your computer and use it in GitHub Desktop.
Force WP Autoloaded is no
/// No like, just literal
$nl = [
'_transient_wpassetcleanup_assets_info',
'_transient_wc_attribute_taxonomies',
'_transient_dirsize_cache',
'asp_updates',
'Avada_backups',
'aviaAsset_css_filecontent',
'aviaAsset_js_filecontent',
'apmm_font_family',
'blc_installation_log',
'br_get_taxonomy_hierarchy_product_cat',
'brainstrom_bundled_products',
'ced_etsy_chunk_products',
'channel_statics',
'cherry_customiser_fonts_google',
'count_per_day_search',
'cron_projects',
'cp_modal_preset_templates',
'dd_normal_button',
'dd_float_button',
'essential-grid_update_info',
'et_divi',
'fusion_options',
'fusion_options_500_backup',
'fs_accounts',
'fbrfg_favicon_non_interactive_api_request',
'itsec-storage',
'ig_last_gallery_items',
'IWP_backup_history',
'jetpack_file_data',
'jetpack_static_asset_cdn_files',
'jetpack_plugin_api_action_links',
'jet_menu_options',
'jetpack_active_plan',
'joc_plugins',
'gform_version_info',
'fs_api_cache',
'fs_accounts',
'limit_login_logged',
'mepr_options',
'monsterinsights_report_data_overview',
'mwp_public_keys',
'mw_adminimize',
'nss_plugin_info_sfwd_lms',
'nm_theme_custom_styles',
'nm_instant_suggestions_product_data',
'thrive_tcb_download_lp',
'top_opt_already_tweeted_posts',
'page_scroll_to_id_instances',
'permalink-manager-external-redirects',
'permalink-manager-redirects',
'permalink-manager-uris',
'personify_active_campaign_tags',
'redux_builder_amp',
'revslider-addons',
'td_011',
'td_011_log',
'td_011_settings',
'tve_leads_saved_tpl_meta',
'otgs-installer-log',
'otgs_active_components',
'personify_active_campaign_fields',
'ping_sites',
'rank_math_seo_analysis_results',
'uninstall_plugins',
'um_cache_fonticons',
'uncode',
'widget_custom_html',
'wd_audit_cached',
'wc_psad_google_font_list',
'wc_facebook_google_product_categories',
'wc_remote_inbox_notifications_specs',
'wp_installer_settings',
'wp_schema_pro_optimized_structured_data',
'ws_menu_editor_pro',
'wcml_trbl_products_needs_fix_postmeta',
'woocommerce_ultimate_tabs_options',
'woocommerce_tracker_ua',
'woolementor-docs-json',
'wp_custom_admin_interface_settings_AdminMenu',
'wpf_template',
'wpassetcleanup_global_data',
'wphb_scripts_collection',
'wphb_styles_collection',
'wpml_strings_need_links_fixed',
'wpseo_taxonomy_meta',
'wpseo-premium-redirects-export-plain',
'yikes_woo_reusable_products_tabs_applied',
'zero-spam-settings',
];
/// Likes
$ll = [
'_transient_amp%',
'_transient_bawmrp%',
'_transient_fusion%',
'_transient_google%',
'_wpallexport_session_%',
'%mytheme%',
'ai1wm%',
'astra-sites-and-pages%',
'astra-blocks%',
'bwp_minify_detector%',
'cherry_customiser%',
'ctf%',
'css3_vertical_table_shortcode%',
'duplicator%',
'edd_api_request_%',
'ced_etsy_product_logs_%',
'ced_etsy_product_inventory_logs_%',
'ced_etsy_chunk_products_%',
'ced_etsy_order_logs_%',
'elementor_pro_remote%',
'fs_contact_form%',
'Jupiter_options%',
'fusion_dynamic%',
'giapi%',
'nf_form_%',
'mailserver%',
'qode_options%',
'quickppr_redirects%',
'tinypng%',
'trustpilot%',
'of_template%',
'premiothemes_comingsoon_%',
'p3%',
'userpro%',
'updraft%',
'ywsn%',
'ywccp%',
'wc_csv_import_suite_background_import_results%',
'wfacp_c_%',
'wp-optimize%',
'wfcm%',
'wpseo-gsc-%',
];
// Try to reduce autoload
$sql = 'UPDATE '.$wpdb->options. ' SET autoload = \'no\' WHERE option_name IN ( ';
foreach( $nl as $i ) {
$sql .= '\''.$i.'\', ';
}
$sql = trim( $sql, ', ' ). ' ) OR ';
foreach( $ll as $i ) {
$sql .= 'option_name LIKE ( \''.$i.'\' ) OR ';
}
$sql = trim( $sql, ' OR ' );
$wpdb->query( $sql );
@ramonfincken
Copy link
Author

ramonfincken commented Mar 4, 2024

Extra

	$sql = 'SELECT SUM( LENGTH( option_value ) ) /1048576 AS mp_calc FROM '.$wpdb->options. ' ';
	$sql .= 'WHERE autoload = \'yes\'';
	$results = $wpdb->get_results( $sql );

	if( isset( $results[0] ) && $results[0]->mp_calc > 2 ) {

@willsha101
Copy link

Has anyone found a list of what plugins don't need to be in Autoload, so we can turn them off, like I don't know if limit_login_logged should be loading on every page for every visitor.

@ramonfincken
Copy link
Author

limit login attempts is a small one.

and yes you could set all to no and your site will still work but.... it will need more SQL queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment