{"id":18403783,"date":"2025-04-07T16:14:37","date_gmt":"2025-04-07T16:14:37","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wordpress-database-error-cache_key-cannot-be-null\/"},"modified":"2025-04-07T17:32:32","modified_gmt":"2025-04-07T17:32:32","slug":"wordpress-database-error-cache_key-cannot-be-null","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wordpress-database-error-cache_key-cannot-be-null\/","title":{"rendered":"WordPress database error: cache_key cannot be null"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">After upgrading from PHP 7.4 to PHP 8.4 I get this error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WordPress database error Column 'cache_key' cannot be null for query INSERT INTO <code>dhdl_ctf_feed_caches<\/code> (<code>cache_value<\/code>, <code>last_updated<\/code>, <code>cache_key<\/code>, <code>cron_update<\/code>, <code>feed_id<\/code>) VALUES ('&#091;\\\"error\\\"]', '2025-04-07 15:40:17', NULL, '', 'legacy') made by require('wp-blog-header.php'), require_once('wp-includes\/template-loader.php'), include('\/themes\/dhdl\/single-gruender.php'), do_shortcode, preg_replace_callback, do_shortcode_tag, ctf_init, TwitterFeed\\CtfFeed-&gt;maybeCacheTweets, TwitterFeed\\CtfCache-&gt;set_transient, TwitterFeed\\CtfCache-&gt;update_or_insert<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I found these 2 topics related to this error:<\/p>\n\n\n\n<ul>\n<li><a href=\"https:\/\/wordpress.org\/support\/topic\/cache_key-cannot-be-null-for-query-insert-into-wp_ctf_feed_caches\/\">https:\/\/wordpress.org\/support\/topic\/cache_key-cannot-be-null-for-query-insert-into-wp_ctf_feed_caches\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wordpress.org\/support\/topic\/database-error-in-2-1-1\/\">https:\/\/wordpress.org\/support\/topic\/database-error-in-2-1-1\/<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately the settings do not work anymore (they just load forever), so I cleared the cache using this code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>global $wpdb;<br \/>$table_name = $wpdb-&gt;prefix . \"options\";<br \/>$wpdb-&gt;query( \"<br \/>    DELETE<br \/>    FROM $table_name<br \/>    WHERE <code>option_name<\/code> LIKE ('%\\_transient\\_ctf\\_%')<br \/>    \" );<br \/>$wpdb-&gt;query( \"<br \/>    DELETE<br \/>    FROM $table_name<br \/>    WHERE <code>option_name<\/code> LIKE ('%\\_transient\\_timeout\\_ctf\\_%')<br \/>    \" );<br \/><br \/>global $wpdb;<br \/>$table_name = $wpdb-&gt;prefix . \"options\";<br \/>$result = $wpdb-&gt;query(\"<br \/>    DELETE<br \/>    FROM $table_name<br \/>    WHERE <code>option_name<\/code> LIKE ('%ctf\\_\\!%')<br \/>    \");<br \/>delete_option( 'ctf_cache_list' );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">But the error still persists. <br \/>Why is the cache_key rendered NULL? Is there anything I can do against it?<\/p>\n","protected":false},"template":"","class_list":["post-18403783","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18403783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18403783\/revisions"}],"predecessor-version":[{"id":18403785,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18403783\/revisions\/18403785"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18403783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}