Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Issue #17 : Fix failing unit test: property of non-object error.
Browse files Browse the repository at this point in the history
Before evaluating ->post_type, pass it to isset().
Short-circuit the conditional if it's not set.
  • Loading branch information
Ryan Kienstra committed Aug 24, 2016
1 parent 6d4b74b commit 48a70cc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions php/class-post-type.php
Expand Up @@ -697,6 +697,8 @@ public function filter_out_settings_if_removed_in_metabox( $content ) {
$post_type_object = get_post_type_object( static::SLUG );

$should_filter_content = (
isset( $post->post_status )
&&
( 'publish' !== $post->post_status )
&&
current_user_can( $post_type_object->cap->edit_post, $post->ID )
Expand Down

0 comments on commit 48a70cc

Please sign in to comment.