WordPress generating Undefined Variable warning
As the warnings say, $post is used but not defined, hence “Undefined variable $post” and then ‘Attempt to read property “ID” on null’. It seems like the global $post is in an erroneous location and should be before the if statement: global $post; if ( is_singular() && wp_attachment_is_image ( $post->ID ) ) You may also … Read more