This is a very odd error that I haven't been able to find the underlying cause of or the solution yet.
Errors showing in various places within the WP Admin;
Notice: map_meta_cap was called incorrectly. The post type shop_order is not registered, so it may not be reliable to check the capability "read_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 /public_html/wp-includes/functions.phpon line 4147
Notice: Undefined property: stdClass::$ID in /public_html/wp-admin/includes/dashboard.php on line 491
Notice: Undefined property: stdClass::$post_type
This has occurred when moving a site between servers. These errors only started showing when I went through the usual debugging steps after seeing some odd behaviour. The site has been moved between so many low quality hosting providers in the past, that I had to manually strip out loads of environment specific settings that had been bundled in with core WordPress files (i.e. a php.ini file hidden in the /wp-admin/ folder and various .htaccess files that had been placed within multiple folders etc. ). So this may be something somewhere in here that has been missed.
I'm fairly sure that once I know what these two errors are caused by, and how to fix them, that all the other weird things I'm seeing will also be solved.
Debugging process so far;
- Updated everything (Core, Themes, Plugins)
- All plugins disabled
- Using default 2017 theme
- WordPress PHP files replaced with a fresh install
- DB uploaded (I think the problem is in here somewhere - I can't see how it could be anywhere else given the above?)
- Tested multiple PHP versions to rule that out - same issue regardless of PHP version
- I was seeing a "Submit for Review" button on WooCommerce Add Product page, so tested this solution, http://www.techextensor.com/fixno-publish-but-submit-for-review-button-displayed-to-site-admin/ - and noticed that the DB tables were half InnoDB and half MyISAM, so I updated everything to use MyISAM and ran a table repair on all the DB tables. I then also
- Ran a database cleaner plugin, https://en-gb.wordpress.org/plugins/advanced-database-cleaner/, on the off chance this would clean up anything weird that was going on
Not really sure what else to try to get this working?
Running a completely clean WP installation works perfectly as normal. I just don't want to go to the effort of re-building something, as this is probably some weird setting / odd custom line of code somewhere that someone has put in that is breaking everything.
Any pointers appreciated