Hi aecnews, thanks for using the plug-in. I’ll have a look at the warnings you’ve reported and issue an update.
The plug-in is small and usually ticking along merrily between WordPress updates, so there’s not been a need to update it.
But it looks like now there is, I’ll report back with my findings.
Hi Sander,
Thanks very much. Yes. You are correct. It just ticks along.
FYI it is WP 5.9 with plugin version 1.1.4.
The website is here, if that is of any help: https://aseannewstoday.com/
Thank you, stay safe.
John
This part of the plugins accepts a list of posts (an array of retrieved posts after they’ve been fetched and internally processed.). If you’re seeing a warning that iterating on that is not possible then I suspect there’s an logic error on the theme, as an empty list should be returned.
Here’s the source https://github.com/svandragt/hide-trackbacks/blob/1.1.4/hide-trackbacks.php#L112
If you’d like me to give more details could you please provide the following:
– Can you reproduce it with one of the default themes, to rule out the theme?
– could you post a link to one of the pages where this warning is happening so I can inspect the html and derive context from it.
– do you know the php version you are using, this can be found on the site health screen.
Hope we can get this sorted.
Thanks, Sander
Hi Sander.
Thanks very much. I’ll have a look over the weekend. I’m seeing this in the server error logs. It’s probably a theme fault. PHP version 7.4
Thanks very much.
John
Hi John,
I’ve pushed a new version 1.1.5 where it’s being extra checks around this issue, and the PHP warning will no longer show.
I’ll mark the support issue as resolved.
Hi Sander,
Thanks very much.
Any tips on where I should go hunting in the theme looking for what was causing that?
Thanks again, stay safe.
John
The filter is this one: https://developer.wordpress.org/reference/hooks/the_posts/
It is used by get_posts()
: https://developer.wordpress.org/reference/classes/wp_query/get_posts/.
So to start, if you have Query Monitor active, navigate to a page where you see the warning happening (bar will turn orange). Query Monitor will tell you also what template is loaded. Search that for get_posts
.
It also could be code messing with global $posts
variable, if that’s happening all bets are off.
The fix depends on how it’s being used, I see you’re using a commercial theme so perhaps you’re able to get support. https://www.gabfirethemes.com/themes/advanced-wordpress-newspaper-theme/
Apart from the warning, there are no side effects.
Hi Sander,
Sorry for the late reply.
Thank you for the tips. I’ll go searching.
Stay safe,
John