$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Avoid theme updates, just one theme|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Avoid theme updates, just one theme

matteradmin10PV0评论

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');
}

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far