• Resolved atutrabajo

    (@atutrabajo)


    Dear @s. Good night.
    I just gave you a couple of examples so as not to overwhelm you. But, strictly speaking, it’s been several days since, according to my error log file, your plugin is generating the following errors:

    [Mon Jan 09 14:08:06.360906 2023] [:error] [pid 670149:tid 47849880749824] [client 40.77.167.23:0] PHP Warning: Attempt to read property “ID” on null in /home/username/domain_name/directory_name/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150


    [Mon Jan 09 11:46:40.429869 2023] [:error] [pid 563779:tid 47849964308224] [client 182.79.238.133:0] PHP Warning: Attempt to read property “ID” on null in /home/username/domain_name/directory_name/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150


    [Sun Jan 08 14:21:40.217307 2023] [:error] [pid 3877515:tid 47849878648576] [client 40.77.167.23:0] PHP Warning: Attempt to read property “ID” on null in /home/username/domain_name/directory_name/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150

    As you can see, what changes is the client but it is ALWAYS the same error.
    Could you please tell me what is happening?
    From already thank you very much.
    Regards.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Arya Dhiratara

    (@aryadhiratara)

    Hi @atutrabajo

    I can’t replicate the issue. At first I tought it’s because there’s a post/page that doesn’t have a featured image. But when I tried to remove the featured image in some post/page in some of my websites, the error not shows up.

    I need you to help me solve the issue, and I will put in the next updates if it solved.

    There are several things that we can try.

    • try move the global $post; in line 136 to line 125 (before if ( is_user_logged_in() ) {, right after
    • if the error still exist, try to change this code $thumbnail_id = apply_filters( 'preload_featured_images_id', get_post_thumbnail_id( $post->ID ), $post ); on line 150 to
    if ( has_post_thumbnail() ) {
        $thumbnail_id = apply_filters( 'preload_featured_images_id', get_post_thumbnail_id( $post->ID ), $post );
    }

    or

    if ( ! is_null( $post ) ) {
        $thumbnail_id = apply_filters( 'preload_featured_images_id', get_post_thumbnail_id( $post->ID ), $post );
    }

    Hope one of those solve the issue. Please try the first one (move the global $post; line) first. Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘Constant Error Log’ is closed to new replies.