map_meta_cap Errors in WordPress Dashboard

I got a call from a client who was getting weird messages on their WordPress Dashboard about map_meta_cap being called incorrectly. They were unable to edit posts or do much of anything, though the Admin panel all displayed everything correctly, and the front-end of the website was working fine.

So I logged in to take a look and discovered this was the full text of the error message:

Notice: map_meta_cap was called incorrectly. The post type scheduled-action is not registered, so it may not be reliable to check the capability "edit_post" against a post of that type. Please see Debugging in WordPress for more information. (This message was added in version 4.4.0.) in /wp-includes/functions.php on line 4903

I did some digging and it seemed like this may have been related to some comments, so I checked the Comments page and it had the same error at the top of the page.

I thought this was strange as this is not a website that accepts comments, so I checked and sure enough, there were some very strange comments in there. I tried to delete the offending comments, but got this error:

Warning: Cannot modify header information - headers already sent by (output started at /wp-includes/functions.php:4903) in /wp-includes/pluggable.php on line 1265

The comments would not delete. After doing some more digging into the comments that were there, I discovered they were related to WooCommerce. WooCommerce was not installed, but I discovered that someone had installed WooCommerce temporarily, tested it out, and then deleted the plugin.

I reinstalled WooCommerce, and the errors went away as did the comments on the Comments page of the Admin panel. WooCommerce uses comments for things like changing the status of orders and such, and if everything is not cleared out before WooCommerce is uninstalled, it can leave remnant comments that then break core WordPress functionality, like editing pages and posts.

 

Leave a Reply

Your email address will not be published. Required fields are marked *