There has been a critical error on this website for _/public_html/wp-includes/widgets.php on line 617

After updating the WordPress site my site crashed. I can't even access WordPress dashboard. Get message... There has been a critical error on this website for _/public_html/wp-includes/widgets.php on line 617 But if I removed the bellow code form (_/public_html/wp-includes/widgets.php on line 617), my site would again look good. $widget = array_merge( $widget, $options ); I have to remove this code every time I update WordPress. How can I fix my theme? Or how to fix this problem so that it does not happen again and again? Please someone help me.

Comment (1)

Jese Leos

12 hours ago

Verified user

First of all it's not a best practice to update in core WordPress files. Solution: Step-by-Step Troubleshooting 1. Enable Debug Mode To gain more insight into the issue, enable WordPress debug mode: Open your wp-config.php file. Add the following lines to enable logging: define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); This will log the error messages to wp-content/debug.log. Check the log file to identify if the issue is caused by a plugin, theme, or something else. 2. Check Theme Compatibility The issue could be caused by an outdated or incompatible theme. Here's what you can do: Update Your Theme: Ensure your theme is up-to-date with the latest WordPress version. Switch to a Default Theme: Temporarily switch to a default theme like Twenty Twenty-Two to see if the error persists. You can do this by renaming your current theme folder via FTP. WordPress will then load a default theme automatically. 3. Check Plugin Compatibility Plugins can also cause conflicts during WordPress updates. Follow these steps: Disable All Plugins: Rename the wp-content/plugins folder to plugins_old via FTP and check if your site works. If it does, a plugin is causing the issue. Reactivate Plugins One by One: Rename the folder back to plugins and reactivate each plugin individually to identify which one is causing the conflict. 4. Avoid Editing Core Files Manually editing core files like wp-includes/widgets.php is not recommended. WordPress core files are overwritten with every update, so any manual changes will be lost, causing the same problem to reoccur. Instead, find the root cause and apply the fix in your theme or plugin. If you need customizations, consider using a child theme or custom plugin instead of editing core files directly. 5. Consult Theme or Plugin Support If you've identified that a specific theme or plugin is causing the issue, check the support forums or contact the developers for a fix or patch. 6. Reinstall WordPress Core Files If you suspect that the WordPress core files are corrupted, you can re-upload them: Download the latest version of WordPress from wordpress.org. Extract the ZIP file. Upload the wp-admin and wp-includes folders to your server via FTP, overwriting the existing ones (but do not overwrite wp-content or wp-config.php). This ensures that no core files are missing or corrupted. 7. Create a Child Theme for Customizations If the error is due to theme customizations, create a child theme instead of editing core theme files directly. This way, your customizations won't be lost during updates. Here’s how to create a child theme: Create a folder in wp-content/themes/ called your-theme-child. Inside that folder, create a style.css file with this content: /* Theme Name: Your Theme Child Template: your-theme */ Create a functions.php file for adding any custom PHP code. 8. Restore Backup If you have a backup from before the update, restoring the backup can be the quickest fix. After restoring, test the WordPress update in a local or staging environment to ensure compatibility before applying it to the live site. Note: Please take a backup of your site before applying any solutions on the live server. It's always preferable to debug and fix issues in a local environment to avoid breaking the live site.

You’ll be in good company