Skip to content

Commit

Permalink
Check post is an object before getting its ID
Browse files Browse the repository at this point in the history
  • Loading branch information
notnownikki committed Oct 2, 2017
1 parent db507cd commit d4273b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ function gutenberg_ensure_wp_api_request() {
* @return array Filtered settings.
*/
function gutenberg_disable_editor_settings_wpautop( $settings ) {
$post = get_post();
if ( ! isset( $settings['wpautop'] ) ) {
$settings['wpautop'] = ! gutenberg_post_has_blocks( get_post()->ID );
$settings['wpautop'] = ! ( is_object( $post ) && gutenberg_post_has_blocks( $post->ID ) );
}

return $settings;
Expand Down

0 comments on commit d4273b1

Please sign in to comment.