rinatkhaziev / wp-frontend-uploader

WordPress plugin that allows your visitors to upload media from the front-end
53 stars 52 forks source link

Use proper return value check for get_post call in Frontend_Uploader::approve_post #75

Closed david-binda closed 7 years ago

david-binda commented 7 years ago

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.

Fixes #74

rinatkhaziev commented 7 years ago

Thanks @david-binda!