Skip to content

Commit

Permalink
Merge pull request #2853 from WordPress/fix/notice-in-compat-lib
Browse files Browse the repository at this point in the history
Check post is an object before getting its ID. Props @notnownikki
  • Loading branch information
karmatosed authored Oct 2, 2017
2 parents 6520235 + d4273b1 commit 2753f63
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 2753f63

Please sign in to comment.