WP Harvest WooCommerce WordPress tutorial default

If your WordPress site shows you have an update available, but none can be found in themes or plugins, you can use this snippet to debug the issue.

/**
* Debug Pending Updates
*
* Displays hidden plugin and theme updates on update-core screen.
*/
function debug_pending_updates() {
// Rough safety nets
if ( ! is_user_logged_in() || ! current_user_can( 'update_plugins' ) || ! current_user_can( 'update_themes' ) ) 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 .= "
Plugin $plugin is reporting an available update.
";
}
}
// 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 .= "
Theme $theme is reporting an available update.
";
}
}
if ( empty( $output ) ) $output = "No pending updates found in the database.";
echo "
Pending updates
" . $output;
}
add_action( 'core_upgrade_preamble', 'debug_pending_updates' );

Leave a Reply

Your email address will not be published. Required fields are marked *