Support » Plugin: Optimize More! - Images » Errors that consume (a lot of) resources

  • Dear All. Good night. I comply with informing you that, in my error log, I see the following (related to your plugin) () () Obviously for security reasons, I replaced my username and my site with; myuser/mysite, heh. And, I directly removed the data from the IDs and replaced them with X, Y, Z.

    [Wed Jan 25 00:26:03.195953 2023] [:error] [pid X:tid Y] [remote Z] PHP Warning: Attempt to read property “ID” on null in /home/myuser/mysite/wp-content/ plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150

    Strictly speaking, I said “errors” (in the plural) because it appeared on several occasions and, with various IDs. But, it is only ONE.

    Finally, you should know that, according to my hosting, this type of error (and some others that are NOT from your plugin), is responsible for…
    …”your website continues to reach the established hosting limits”…

    So please, could you solve it as soon as possible?

    I await your comments.

    From already thank you very much.


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

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


    Hi @atutrabajo

    Thank you for using my plugin.

    I have told you in your previous thread (, I really can’t replicate the issue and need your help to find the solution.

    Please try some option that I wrote in the previous thread. Really appreciate it 🙂

    Thread Starter atutrabajo


    Hello Arya. Yes. Now I remember you (It happens that I am “fighting” with several plugin developers at the same time, heh). Anyway.

    Having said that:

    I read what you posted in the previous thread. But you must understand that you are talking to a “simple” Administration Graduate who understands NOTHING about Programming (and who also hates it, heh).

    However, because I know I need to do this and (for now) I can’t pay someone else to do it, I’m slowly fixing a few things that may have caused this and other problems.

    When I’m done, I’ll get to yours and I’ll tell you, okay?

    See ya!

    Thread Starter atutrabajo


    Hello. Me again, heh. I have a good and a bad one for you:

    The good news, I already “discovered” (I think) where the problem is.

    The bad, I have no idea if this is good or bad, heh.

    I explain:

    Yesterday I told you that…

    …”little by little I am solving some things that may have caused this and other problems”…

    In this sense, you should know that, in my “zeal” (someone would say obsession, heh:), to optimize my site, I had read (among the thousands of things I read because I don’t understand ANYTHING about this, heh), that could you add to my function.php some code like this;

    As you can see, there are (were) about 26(twenty-six) optimizations. And I say there was because, if you look (OK) there are codes that are NO longer there and, in the same line is why (*)

    (*) If you notice ALL the codes, they are headed (commented) with an explanatory line that starts with the // plus an order number.

    For some strange reason that I don’t know, suddenly, the site began to have a series of “strange” behaviors and, when I consulted with my hosting, they “thrown” me (among others), the error that your plugin generated (And it gave rise to to this ticket).

    Of course, I sent ALL the developers of the “compromised” plugins lines like the ones I sent you, and while I waited for your responses, I continued to investigate what was going on.

    One of the things I tried, obviously, was to replace the theme that’s in use and soooo! The error “disappeared”.

    Ergo. As said theme (Hello Elementor Child) has been installed for a while and, it was the 1st. Every time I had this problem, the “logic” indicated that the problem was NOT the theme, but what it contained.

    And as precisely, the detailed functions are installed in the function.php of said child theme, I tried, reactivating the child theme but removing said functions and soooo! The error disappeared.

    Conclusion (Not to make it longer, heh).

    One (or several) of those functions, were generating the error(s) that my hosting attributed to those error codes that I sent to the plugin developers (like you, heh).

    Ergo. Since I didn’t know which one of those function(s) it was, I started to;

    a) Install each feature (One at a time)

    b) Test the ENTIRE site

    c) Verify if the error(s) reappeared.

    Now to finish. Until now the errors had NOT reappeared. But…

    Until yesterday, I had tried with (almost) half of the functions, so I had to sleep, heh.

    In fact, if you look (well) at the list, you will see that almost halfway there is a line that says…

    Until here (Day I)

    Well. That’s because, precisely, I got there with the tests, heh.

    And guess what. Exact. So far, the errors have NOT reoccurred. Except one which is, unfortunately, the following (As always I will replace my user and my site with; myuser/mysite, heh)…

    …”[Fri Jan 27 11:12:50.541874 2023] [:error] [pid 1547091:tid 47495644215040] [remote] PHP Warning: Attempt to read property “ID” on null in /home/myuser/ mysite/wp-content/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150”…

    What is the good new? That those IDs are NOT MINE, heh.

    Let me explain: This site is still under development and, therefore, I finish doing something, I test, correct, test again and so on.

    And one of the (many) tests I do is, of course, the performance tests on Pagespeed.

    Ergo. If those IDs are NOT mine, then they must be one of the many that Pagespeed uses to “simulate” its tests, right?

    That is why, probably, what you told me about that…

    …”I can’t replicate the problem“…

    Because, precisely, the problem is NOT generated by my site, but by Pagespeed, testing my site, heh.

    In short, if I were you, I would do the following;

    1) I would see if, in the list of optimizations that I attached, there are some/s that can generate a behavior of your plugin like the one described in the error that appears.

    2) If so, please reconsider the instructions you sent me from the beginning

    O well. If you think that all this that I described has nothing to do…

    3) You reiterate to me what you want me to do.

    I await your comments.


    P.d I: While I was writing this, I kept testing things and, as in the Pagespeed tests I did, it happened to me that the images (just the “metie” of your plugin), seemed to me that they took longer than before to load (enable) the function 9) (Disable image scaling) and 12) (Eliminate JS enqueued in the header and take it to the footer) I re-enabled these functions and, later, I did the test in question again in Pagespeed. And guess what. Exact. The “problem” with your plugin Gone!

    Ergo, these are the UPDATED functions installed in my function.php, plus their corresponding “explanation”;

    What does this mean? (I think, heh).

    a) That some of the functions that had been installed caused the problem that your plugin “generated”.

    b) That some of the functions that are below the line that says…

    Until here (Day I)

    They cause the problem and because of that, I was still getting ONLY the error generated by your plugin.

    c) That the problem was NOT generated by any of the optimizations above that line. But when removing those indicated as 9) and 12) the problem generated by the optimizations below that line reappeared.

    Whatever. The problem with your plugin is NO LONGER. But…

    As I still need to install, test and verify the optimizations below the line in question, tomorrow I will tell you how it went, do you think?

    For now, that’s all from me.

    You (who surely know more about programming than I do) for your part, if you wish, can analyze the optimizations in question. And, if you see something that helps me not to continue analyzing one by one, let me know, okay?

    P.d II: And if after analyzing all this, you still think that the changes you mentioned in your code should be made, let me know. Dale?

    P.d III: It was (too) late for me here. Ergo, I’m going to sleep because tomorrow my son comes to visit me. And, precisely for this reason, tomorrow (nor) will I be able to do the tests that I need (*)

    (*) Unless I do them when my son falls asleep or when he leaves, heh.

    Therefore, if you wish, you have at least (almost) all day tomorrow to tell me if any of the optimizations that I need to (re)test (since 15), have (or could have) something to do with the problem that gave rise to this thread.

    See ya.

    Thread Starter atutrabajo


    Another yes, I say…

    When I wanted to enter Yoast/Adjustment to take a screenshot and send it to my hosting (because of another error I’m dealing with them), it AUTOMATICALLY gave me “Error 520” (Cloudflare) in my browser and, in my cPanel/Error, The following appeared to me;

    [Fri Jan 27 23:38:08.781207 2023] [:error] [pid 1133897:tid 47495671531264] [remote] PHP Warning: Attempt to read property “ID” on null in /home/myuser/mysite/ wp-content/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150, referer: http://mysite/.env

    Do you have anything to do with it?


    I don’t know if it was a coincidence or that ID belongs to you and – perhaps – they were testing something.

    What do I know


    I await your comments.


    Thread Starter atutrabajo


    Hello. Well, frankly, I DON’T know what else to do anymore because I’m seeing (again) the SAME errors that I started this ticket with. That is…

    [Thu Feb 02 13:02:34.111139 2023] [:error] [pid 2256614:tid 47495717758720] [client] PHP Warning: Attempt to read property “ID” on null in /home/myuser/mysite/ wp-content/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150

    And, to top it off, now – also – he messes with my login???…

    [Thu Feb 02 15:32:14.305887 2023] [:error] [pid 4166302:tid 47495673632512] [remote] PHP Warning: Attempt to read property “ID” on null in /home/myuser/mysite/ wp-content/plugins/optimize-more-images/includes/classes/partials/preload-featured-imgs.php on line 150, referer: mysite/wp-login.php

    Please, if they are (or are not) you and/or it is Pagespeed’s “fault”, let me know so that I can stop screwing with this.

    I await your comments.


    PS: One way or another, remember that I still need to install/test a couple of optimizations from the list I sent you.

    Something that, if I don’t fall asleep before, I’ll start, right now, heh.

    Plugin Author Arya Dhiratara


    Hi @atutrabajo

    Sorry, I’ve been busy working on some client projects.

    I’m having trouble understanding your explanation in your previous reply. Seems that you have a lot of custom optimization in your site. I really couldn’t find the problem.

    Perhaps the error came from the hosting environment (php version, etc), or the custom optimization. I’ve never had that error on any of my sites and all of my clients’ sites (which all have different hosting environments).

    So I think the only way to avoid the error on your site is to disable the preload featured image feature. All of the functions in that file (/optimize-more-images/includes/classes/partials/preload-featured-imgs.php) won’t run if the feature is off.

    Again, really sorry.

    Thread Starter atutrabajo


    Hello. It seems that you were right (put it, heh:).

    After, following your instructions, I deactivated the mentioned option from your plugin, I already did several tests and in ALL of them it gave me that…
    …”No recent web server errors exist for your domain:“…

    Ergo, in that sense, apparently the problem would be solved, heh!
    However, like the plugin functionality, it is one of the ones that I highlight the most and, I need to, I am going to describe what I did.
    a) I disabled the mentioned functionality (Preload Featured Images)

    b) I “replaced” it with the following code in my function.php…

    /* 27) Preload (preload) the featured image in each post */
    add_action(‘wp_head’, ‘preload_post_attachment_image’);

    function preload_post_attachment_image(){
    if (has_post_thumbnail()) {
    $attachment_image = wp_get_attachment_url( get_post_thumbnail_id() );
    echo ”;

    (*) In case anyone is interested: I extracted this code from;

    c) I checked EVERYTHING again and… soooo! There were no more errors

    I hope that this can be of some use (to you and/or anyone reading this thread).

    See you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.