Support » Fixing WordPress » wp_commentmeta doesn’t exist.

  • Maurice_Ormon


    I’ve been getting this error:

    [12-May-2019 16:05:53 UTC] WordPress database error Table ‘i1368684_wp2.wp_commentmeta’ doesn’t exist for query SELECT comment_id, meta_key, meta_value FROM wp_commentmeta WHERE comment_id IN (15966,15967,15968,15970,15975) ORDER BY meta_id ASC made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/twentyfourteen/archive.php’), get_sidebar, locate_template, load_template, require_once(‘/themes/twentyfourteen/sidebar.php’), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Recent_Comments->widget, get_comments, WP_Comment_Query->query, WP_Comment_Query->get_comments, _prime_comment_caches, update_comment_cache, update_meta_cache

    I’ve searched through the forum and found the post about using PHP Admin to repair and / or optimize the database, and I’ve done both those things. Neither helped.

    But the thing is the wp_commentmeta does not even exist within the database!

    I tried changing to the twentyseventeen theme, but the same error appears.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    Well, you must have a comment meta table these days. At one time, WP did not have comment meta. If your site is fairly old, it may not have had one to start with. But it should have been added during WP updates. If you have not updated in that long a time, it’s well past time that you do.

    I suppose it could have been accidentally dropped by some errant code, but that seems unlikely. Regardless of the cause, you do need to have the table. Updating WP should also update the DB tables. If your WP is otherwise up to date and still no commentmeta table, the easiest way to add it is through phpMyAdmin. You should be able to access it through your hosting control panel. After you enter the app, select your WP DB (i1368684_wp2) in the left sidebar. Next, make a full backup of the current database, just to be safe. Go to the Export tab, the defaults should be OK, just click Go. Save the file somewhere safe when prompted.

    Go to an existing table in the WP DB, then click to More>Operations and note what the current Engine and Collation values are. If they are not InnoDB Engine and utf8mb4_unicode_ci collation, the following query will need to be adjusted to reflect the values for your tables. (They can also be changed after the fact)

    Now go back to the full i1368684_wp2 database item in the sidebar, then go to the SQL tab and paste in the following query:

    CREATE TABLE wp_commentmeta (
      meta_id bigint(20) UNSIGNED NOT NULL,
      comment_id bigint(20) UNSIGNED NOT NULL DEFAULT '0',
      meta_key varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
      meta_value longtext COLLATE utf8mb4_unicode_ci
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    The other defaults should be fine. Click Go. You now have an empty comment meta table your theme can use for whatever purposes. Existing comments will not have any meta data, so any functionality dependent on meta data will still fail for existing comments. New comments should be handled properly without errors.

    • This reply was modified 1 year ago by bcworkz. Reason: code fixed


    The only update I didn’t have installed was 5.2. I’ve had the auto-updater working fine for at least a couple of years. (But GoDaddy is often a difficult hosting site to do updates on – I tried to update to 5.2 a couple of times but it timed out.)

    I managed to get the 5.2 update installed and it did indeed resolve the issue of the error log filling.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_commentmeta doesn’t exist.’ is closed to new replies.