Support » Fixing WordPress » WP complaining about its own wp_version_check filter?

  • Resolved aaribaud

    (@aaribaud)


    Hello,

    WordPress version: 5.6 fr.

    I am being plagued by the dreaded ‘A plugin has prevented updates by disabling wp_version_check()’ message in the site health page.

    This warning is emitted by wp-admin/includes/class-wp-site-health-auto-updates.php because a filter was added for ‘wp_version_check’.

    After quadruple-checking my plugins, I finally found the only place where the filter is being added: wp-includes/update.php, which does it through the add_action alias of add_filter.

    But wp-admin/includes/class-wp-site-health-auto-updates.php and wp-includes/update.php are both WP files, not plugin files, right?

    So… Am I right in thinking WP is complaining that… WP itself added the filter?

    More importantly: how do I get rid of this problem now? Obviously I cannot remove the filter addition in wp-includes.php, nor can I remove the filter test in wp-admin/includes/class-wp-site-health-auto-updates.php.

    And I can’t just ignore the warning: if I install a plugin that sets a ‘wp_version_check’ filter too, that issue will be hidden by the current warning.

    Thanks for any tip!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator t-p

    (@t-p)

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and switch to the default Twenty Twenty theme. If the problem goes away, enable them one by one to identify the source of the problem.

    If you can install plugins, install Health Check. On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site.

    Thread Starter aaribaud

    (@aaribaud)

    Hello,

    I realize I have not expressed myself clearly enough.

    I already have grepped in my site’s plugins’ code and none of them adds a filter or action for ‘wp_version_check’.

    I am not looking for the root cause of the ‘A plugin has prevented updates by disabling wp_version_check()’ message; I have traced execution of my site’s code and found the root cause.

    In fact, if you just download the wordpress install archive, untar it and grep it for “add_action.*wp_version_check”, you will see the hit for wp-includes/update.php where it does the “add_action( ‘wp_version_check’, ‘wp_version_check’ );”.

    My question is not “help me find what the problem is”, it is “can someone please confirm if what I think is a problem indeed is one or not”.

    Regards,
    Albert.

    EDIT: I have looked at the git repo, and it seems the check was recently changed, in commit 039ce3f16f1 (https://github.com/WordPress/WordPress/commit/039ce3f16f1).

    Previous code did not have the call to has_filter().

    • This reply was modified 3 months, 4 weeks ago by aaribaud.
    Thread Starter aaribaud

    (@aaribaud)

    I’ve gone on looking into the plugins’ code. The only line in any of them which mentions wp_version_check only calls wp_next_scheduled(), which finds out when wp_version_check() is next scheduled; it does not *disable* wp_version_check().

    Next I’ve traced whether wp-include/update.php did in fact set up the filter for wp_version_check that wp-admin/includes/class-wp-site-health-auto-updates.php expects to find, and no, it does not set it up.

    More precisely, at line 878 of wp-includes/update.php, there is a test which, if sucessful, will exit before setting any filters. Exit is performed if ((not on the main site) and (not the admin)) or doing ajax).

    As I am looking at the main site’s health as the admin, the only reason for the test to succeed is wp_doing ajax() returning true.

    I have added debug code and checked that indeed wp_doing ajax() returns true at line 878.

    So since wp_doing ajax() returns true, wp-include/update.php will not set up the filter, and therefore wp-admin/includes/class-wp-site-health-auto-updates.php will not find the filter, not because some plugin prevented the call to wp_version_check() but because WP prevented itself from setting up the call in the first place.

    Can someone now confirm the issue?

    • This reply was modified 3 months, 4 weeks ago by aaribaud.
    • This reply was modified 3 months, 4 weeks ago by aaribaud.
    • This reply was modified 3 months, 4 weeks ago by aaribaud.
    Thread Starter aaribaud

    (@aaribaud)

    For the record, I have reported the issue on the French WP forum at https://wpfr.net/support/sujet/wp5-6-empeche-lui-meme-son-wp_version_check-de-fonctionner/ where a core developer could reproduce the issue. I am closing the issue here in order to avoid duplicates.

    Moderator t-p

    (@t-p)

    I am closing the issue here in order to avoid duplicates.

    Okay. Thanks 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP complaining about its own wp_version_check filter?’ is closed to new replies.