Avoid theme updates, just one theme

admin2025-06-04  3

I stupidly created a ton of websites with custom themes (not child themes, 100% custom) and named my theme folder "custom". Now they are starting to auto-update and get replaced with some theme from the repository that happens to use the same folder name.

I could disable the updates in wp_config, but I don't really like that idea. Isn't there something I can do just in my theme files, to tell WordPress "this is a totally custom theme, not on your repository, don't try to update it"? This info must be around, but I just can't find it. I tried setting a name in my style.css file, but that didn't help, WordPress is still saying "update available" (and will overwrite my files if I click that option).

I usually just don't give my themes a name, my style.css file just starts out with my actual CSS.. and it seems to work fine, until this issue started.

If I rename the folder to something more obscure, that works... but then I'll have to recreate my menus, and not sure what else, because WP thinks I switched themes if I do that.

Maybe some tag I can add to style.css? Something like a "slug" or update URL?

I stupidly created a ton of websites with custom themes (not child themes, 100% custom) and named my theme folder "custom". Now they are starting to auto-update and get replaced with some theme from the repository that happens to use the same folder name.

I could disable the updates in wp_config, but I don't really like that idea. Isn't there something I can do just in my theme files, to tell WordPress "this is a totally custom theme, not on your repository, don't try to update it"? This info must be around, but I just can't find it. I tried setting a name in my style.css file, but that didn't help, WordPress is still saying "update available" (and will overwrite my files if I click that option).

I usually just don't give my themes a name, my style.css file just starts out with my actual CSS.. and it seems to work fine, until this issue started.

If I rename the folder to something more obscure, that works... but then I'll have to recreate my menus, and not sure what else, because WP thinks I switched themes if I do that.

Maybe some tag I can add to style.css? Something like a "slug" or update URL?

Share Improve this question asked Feb 27, 2015 at 19:34 eselkeselk 1135 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 5

If the theme slug matches, but you have no version number in the style.css file (even if Name is missing too), it will always try to update that theme. The easiest way to prevent this is to add a Version in the style.css header and set it to a really high number that is unlikely to be lower than that theme's version:

/*
Version: 999
*/
add_action('after_setup_theme','remove_core_updates');
function remove_core_updates(){

    if(! current_user_can('update_core')){
        return;
    }

    add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
    add_filter('pre_option_update_core','__return_null');
    add_filter('pre_site_transiAent_update_core','__return_null');
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748975933a315311.html

最新回复(0)