do not load cap when entity do not have a post

This commit is contained in:
Jacson Passold 2018-01-18 19:08:39 -02:00
parent e4d7fba82f
commit bead442bda
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ class Entity {
throw new \Exception('the returned post is not the same type of the entity! expected: '.$this->get_post_type().' and actual: '.$this->WP_Post->post_type );
}
}
if($this->get_post_type() !== false) {
if($this->get_post_type() !== false && post_type_exists(Collection::get_post_type())) {
$post_type_obj = get_post_type_object(self::get_post_type());
if(!is_object($post_type_obj)) { //may be called before post_type registration
global ${$this->repository};