The get_post, with default value for $output param, returns either an object of WP_Post class or null, never an object of WP_Error. See: https://developer.wordpress.org/reference/functions/get_post/ for details. Thus is_wp_error is not a proper check for return value.
This commit addresses the issue by replacing !is_wp_error( $post ) by is_object( $post ) conditional.
The
get_post
, with default value for $output param, returns either an object ofWP_Post
class or null, never an object of WP_Error. See: https://developer.wordpress.org/reference/functions/get_post/ for details. Thusis_wp_error
is not a proper check for return value.This commit addresses the issue by replacing
!is_wp_error( $post )
byis_object( $post )
conditional.Fixes #74