Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters
This error indicates a critical incompatibility between your installed WordPress version and the theme you are attempting to activate. The stack trace points directly to wp-includes\widgets.php at line 1261, where a core function call fails because it receives arguments that do not match the expected signature.
The specific error messageâUncaught ArgumentCountError: array_merge() does not accept unknown named parametersâis the smoking gun. It tells us that the version of WordPress running in your D:\xampp\htdocs\wordpress directory (likely a 6.x release candidate or an early point release) has updated the internal implementation of widget handling to enforce strict argument passing rules. However, the theme you are installing is compiled against an older codebase where these arguments were optional or handled differently.
The Root Cause: Signature Mismatch
In modern PHP versions, specifically 8.1 and later, functions that accept named parameters (like array_merge() when used with specific internal logic in newer WP core builds) require strict adherence to their signature. When the core code attempts to merge widget arrays using a call like array_merge(wp_inactive_widgets: Array, sidebar-1: Array...), it expects those arguments to be passed positionally or as valid named parameters matching the function definition.
The theme being installed, in this case "Twenty Twenty", is likely triggering an action hook (after_switch_theme) that passes data structures formatted for a different version of the core. The stack trace shows the flow:
theme.phpfires theafter_switch_themeaction.- This triggers
_wp_sidebars_changedinwidgets.php. - That function attempts to retrieve and merge sidebar widgets.
The crash happens because the theme's registered widgets or the core's interpretation of the widget structure passed by the theme do not align with the new strict typing requirements introduced in the specific WordPress build you are using. Essentially, the theme is trying to pass an object or array where the new core expects a specific key-value pair format that array_merge() cannot reconcile with its current signature enforcement.
Resolving the Conflict
To fix this, you must align your WordPress core version with the theme's requirements. Since the error occurs during installation (likely via FTP or File Manager), standard plugin updates won't work immediately as the theme hasn't been fully recognized yet.
Option 1: Downgrade the Theme Code
If you have the source code for the "Twenty Twenty" theme available, check your functions.php or widget files. Look for any custom registration of widgets that might be passing complex objects instead of standard arrays. If you are using a forked version of a child theme, ensure it does not contain PHP syntax errors related to array definitions.
Option 2: Update WordPress Core
The most reliable long-term fix is to update your WordPress installation. The error suggests you are running a development snapshot or an outdated version that has partially updated wp-includes files but not fully integrated the new widget system.
- Backup your database and
wp-contentfolder. - Download the latest stable release of WordPress from wordpress.org.
- Replace the contents of your
/wp-includes/and/wp-admin/folders with the new stable files. - Re-upload your theme via the dashboard once the core is compatible.
Alternative: Manual Widget Reset
If updating the core causes other regressions, you can try manually clearing the widget state to bypass the merge error during the switch. Access your database directly or use a safe-mode file editor to delete the wp_options entry named option_active_widgets and option_inactive_widgets. This forces WordPress to rebuild these structures from scratch upon the next theme switch, preventing the faulty array_merge call from trying to process corrupted legacy data.
Why This Happens in XAMPP
Running on a local stack like XAMPP often leads to version fragmentation. You might have downloaded an experimental build of WordPress thinking it was stable, or you may have manually edited core files in /wp-includes/ to match an older theme's expectations. Always prefer using the official release versions for development unless you are actively contributing to a specific WP branch where such mismatches are intentional.
For developers building themes or plugins who encounter similar signature errors, ensure your code uses array_merge() only with arrays of arrays or simple key-value pairs, and avoid passing named arguments unless explicitly supported by the target PHP version. If you need robust migration tools for handling widget data across WP versions, consider using a dedicated migration plugin that sanitizes database options before the switch occurs.