plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Update failed: The theme is at the latest version.

Open manobalas opened this issue 4 years ago • 3 comments

When I'm updating, I'm getting this error, can you please check it..

manobalas avatar Jun 21 '21 12:06 manobalas

It sounds like the update information is not filtered correctly when you try to install the update. There are multiple things that could cause that, but there's not enough information to guess what exactly is going on.

Can you post the code that you use to initialize the update checker? If it contains private information, feel free to edit it out. Also, if you're doing anything advanced such as trying to load the update checker only if certain conditions are met, please post that code too.

YahnisElsts avatar Jun 21 '21 13:06 YahnisElsts

Here is the code

if(is_admin() && strpos($_SERVER['PHP_SELF'], 'themes.php') !== false)
{
    require get_template_directory() . '/plugin-update-checker/plugin-update-checker.php';

    $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
        'https://github.com/username/repo-name',
        __FILE__,
        get_template()
    );
    $myUpdateChecker->setAuthentication('ghp_xxxxxxxxxxxxxxxxxxxxxxxx');
    $myUpdateChecker->setBranch('main');
    $myUpdateChecker->checkForUpdates();
}

manobalas avatar Jun 21 '21 20:06 manobalas

I'm guessing that you might need to remove that themes.php condition. At least some (or maybe most) ways of installing updates will run a different PHP file.

On an related note, these conditions you're using will prevent periodic update checks because the update checker won't be loaded in Cron jobs. They may also prevent users from installing updates with third-party tools such as WP-CLI, ManageWP, and so on.

YahnisElsts avatar Jun 21 '21 21:06 YahnisElsts