When posting in a couple spots on two websites that have Newspaper Theme, I have been encountering the following error:
Uncaught Error: array_key_exists(): Argument #2 ($array) must be of type array, null given
in /home3/garretso/public_html/wp-content/plugins/td-subscription/includes/td_subscription.php on line 3276
Call stack:
td_subscription::td_post_theme_settings_mb_save_filter(NULL, ‘4880’)
wp-includes/class-wp-hook.php:324
WP_Hook::apply_filters(NULL, array)
wp-includes/plugin.php:205
apply_filters(‘wpalchemy_filter_td_post_theme_settings_save’, NULL, ‘4880’)
wp-content/plugins/td-composer/legacy/common/wp_booster/wp-admin/external/wpalchemy/MetaBox.php:880
WPAlchemy_MetaBox::apply_filters(‘save’, NULL, ‘4880’)
wp-content/plugins/td-composer/legacy/common/wp_booster/wp-admin/external/wpalchemy/MetaBox.php:2081
WPAlchemy_MetaBox::_save(4880)
wp-includes/class-wp-hook.php:326
WP_Hook::apply_filters(NULL, array)
wp-includes/class-wp-hook.php:348
WP_Hook::do_action(array)
wp-includes/plugin.php:517
do_action(‘save_post’, 4880, WP_Post, true)
wp-includes/post.php:5110
wp_insert_post(array, false, true)
wp-includes/post.php:5212
wp_update_post(array)
wp-admin/includes/post.php:453
edit_post()
wp-admin/post.php:227
Placing this into ChatGPT, it says there’s an error that needs to be fixed in the td-subscription plugin. “Uncaught Error: array_key_exists(): Argument #2 ($array) must be of type array, null given”
“What This Means:
PHP’s built-in function array_key_exists() expects the second argument to be an array, but it was given null instead.
In your case:
File: /home3/garretso/public_html/wp-content/plugins/td-subscription/includes/td_subscription.php
Line: 3276
Cause: The plugin tried to check if a key exists in an array, but that array was actually null.”
While I could possibly fix this manually, any suggestions otherwise?
Hi,
You’ll need to have access to cPanel or you can ask your host to help you and set different php versions for your website so you can test it. – https://support.cpanel.net/hc/en-us/articles/4891132637079-How-to-change-PHP-version-for-a-domain
Thank you!
A function is trying to use array_key_exists() on a variable that is null instead of an array.
**How to fix:**
– The plugin author should ensure that the second argument to array_key_exists() is always an array.
– As a quick fix, you can wrap the call with an is_array() check.
**Example fix:**
php
if (is_array($array) && array_key_exists($key, $array)) {
// ...existing code...
}
Hi,
The error appears to be related to an external post type and the subscription plugin specifically, the lockers provided by the plugin. However, lockers aren’t active for external posts, so this theme option should be disabled: https://prnt.sc/rBCQaBb382dN.
Disabling it removes the locker option from the post edit screen and seems to resolve the issue: https://i.imgur.com/odOozKU.png.
Thank you!