1

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?

2 Answers 2

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
*/
1
  • 1
    Saved me a weekend of worrying about all of my sites... applying this fix now, thanks!
    – eselk
    Commented Feb 27, 2015 at 20:48
0
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');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.