IMTIAZ EPU
Plugin Update

How To Debug WordPress Pending Plugin Update?

Do you have a WordPress site that claims to have a Plugin or Theme update when all plugins are up to date? The debugging code, contributed by Kevin Leary, among this article might show that specific update or Theme is creating the update accessible, detect among your WordPress installation. To find out that plugin’s or theme is creating the unfinished update notification in your WordPress installation, add the following code to your functions.php file of the currently active theme or child theme. Once saved in your function file, add to ?debug_updates your WordPress backend after /wp-admin/. Example: http://yourwebsite.com/wp admin/?.debug_upgrades  
<?php
/**
 * Debug Pending Updates
 *
 * Crude debugging method that will spit out all pending plugin
 * and theme updates for admin level users when ?debug_updates is
 * added to a /wp-admin/ URL.
 */
function debug_pending_updates() {
    // Rough safety nets
    if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) return;
    if ( ! isset( $_GET['debug_updates'] ) ) return;
    $output = "";
    // Check plugins
    $plugin_updates = get_site_transient( 'update_plugins' );
    if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
        foreach ( $plugin_updates->response as $plugin => $details ) {
            $output .= "<p><strong>Plugin</strong> <u>$plugin</u> is reporting an available update.</p>";
        }
    }
    // Check themes
    wp_update_themes();
    $theme_updates = get_site_transient( 'update_themes' );
    if ( $theme_updates && ! empty( $theme_updates->response ) ) {
        foreach ( $theme_updates->response as $theme => $details ) {
            $output .= "<p><strong>Theme</strong> <u>$theme</u> is reporting an available update.</p>";
        }
    }
    if ( empty( $output ) ) $output = "No pending updates found in the database.";
    wp_die( $output );
}
add_action( 'init', 'debug_pending_updates' );
  It has helped you discover that plugin or theme is generating the unfinished update notice on your WordPress website.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Privacy Policy