Closed bobbingwide closed 8 years ago
The problem is due to the fact that the $post_type_args
array passed to register_post_type()
contained a key called cap
which contained the array of capabilities.
This didn't cause a problem in WordPress 4.5, but does with the new code in 4.6.
My current conclusion is that this problem was caused by misuse by oik-types and is not a bug in WordPress. So, since
register_post_type()
we can remove the 'cap' key from the post_type_args array and WordPress will create the capabilities.
....Although they may not be the ones that were first thought of. So maybe the key should be changed from 'cap' to 'capabilities'. if it's being passed. So long as we don't break backward compatibility with 4.5.
In WordPress 4.6-RC1 and WordPress 4.6-RC2 ( and most likely the beta versions ), if oik-types has been used to override a custom post type (CPT) and then the plugin that registered the CPT in the first place is deactivated ( or otherwise no longer registers the post type), then the subsequent post type that is registered has a
cap
property which is an array. Because WordPress now expects this to be anobject
the following Notices are produced on admin pages.Steps to reproduce
jetpack-portfolio post
typeNote: I was using Jetpack 3.8.2. I expect the problem could be recreated using a different plugin that registers any original CPT that is overridden by oik-types.
Workaround
Proposed solution
What we want to do is find a solution for oik-types that'll work regardless of the WordPress version.