• There’s an issue in your plugin where you’re adding a filter for has_post_thumbnail (function filter_has_post_thumbnail() ), you’re checking the global post ID and ignoring the passed through variable.

    So where I’m doing has_post_thumbnail($post_id) (not in the loop) your filter is instead forcing it to check against the global $post->ID instead, please fix this and test your code more thoroughly in future when adding filters to commonly used functions like this.

Viewing 1 replies (of 1 total)
  • Just found this bug as well.

    A simple guard clause to check what is being filtered would fix this.

    For instance:

    if (!is_object($post)) {
    return $post;
    }

    In the filter_has_post_thumbnail function.

    Cheers

Viewing 1 replies (of 1 total)

The topic ‘has_post_thumbnail filter breaking regular usage’ is closed to new replies.