MainWP Pro Lighthouse Extension

In the classwp-content\plugins\mainwp-lighthouse-extension\class\class-mainwp-lighthouse-utility.php there were some really usefull functions “get_score_trend” and “get_score_difference” that take a $site_id as param. In the past I used those on a custom built UI screen. With the new performance update those params are no longer recognized or used in the functions.
Do you see a way to reenable the use of the param?

Hey @JNBG

Welcome to the MainWP community!

I’m checking with the dev team for more info and will get back to you as soon as I can.

@JNBG

Can you please check what version of Lighthouse you are running?

@bojan
The most recent one 5.2.1 - I attached a screenshot of one of the functions I am using from the utility

Thanks @JNBG

We are looking into it.

The behavior changed as part of a performance improvement in the Lighthouse extension.

Previously, get_score_trend() and get_score_difference() accepted a site_id and performed their own database lookup internally. That worked fine for a single site, but it became inefficient when these methods were used in site lists, dashboard tables, Manage Sites columns, or monitoring views. In those cases, the same helper could be called many times per site, causing repeated database queries and an N+1 query pattern.

The current approach is to load the Lighthouse data once, then pass that data object into the helper. This is more efficient because the caller can reuse data that has already been fetched, especially when rendering multiple sites or multiple score columns.

So instead of the helper doing this internally for every call:

$lighthouse = MainWP_Lighthouse_DB::get_instance()->get_lighthouse_by( ‘site_id’, $site_id );

the caller now does that once and passes the result:

$lighthouse = MainWP_Lighthouse_DB::get_instance()->get_lighthouse_by( ‘site_id’, $site_id );

$trend = MainWP_Lighthouse_Utility::get_score_trend( $site_id, ‘desktop_score’, $lighthouse );

$difference = MainWP_Lighthouse_Utility::get_score_difference( $site_id, ‘desktop_score’, $lighthouse );

This gives the same result as the old usage, but avoids unnecessary repeated database lookups.

The new method is better for performance and scales more safely when displaying Lighthouse data across many child sites.

Thanks for the Clarification. I was able to successfully rework my Integration with the new setup.