Issue with register_post_type with custom capability type(s)
I have a plugin for a site that creates multiple custom post types (CPT). Each with their own custom capability specified via the capability_type
attribute of the register_post_type()
function. I copy-and-pasted the code block for each register_post_type()
from the first one, which includes the capability_type
as an array, ie. array('type' , 'types')
. Some of the subsequent CPT didn’t need multiple capability types so I was receiving the warning ‘Notice: Undefined offset: 1 in post.php’ due to a single item in the array. The fix was to remove the array wrapping the single value, et voila, no more warning.