Exception after upgrade Wp-statistics 14.8

[ad_1]

Weird indeed since this method is calls here and also have the parameter https://github.com/wp-statistics/wp-statistics/blob/master/includes/class-wp-statistics-hits.php#L165

Can you please tell me what is your PHP version? additionally, maybe would be good to upgrade the plugin manually.

PHP7.4 I believe.

I note this issue because other developers probably will need to update their code if they call the same function – is there a developer’s update you publish upon major updates like this?

Thank you for the information. It’s clear now that you’re calling the \WP_STATISTICS\Pages::record() method directly.

The error you’re encountering, “Uncaught ArgumentCountError: Too few arguments to function WP_STATISTICS\Pages::record(), 0“, is because this method now requires an argument, specifically an instance of \WP_Statistics\Service\Analytics\VisitorProfile.

In the recent updates, the method signatures and expected parameters have been adjusted. While we typically anticipate developers to use the Hits::record() method, which internally handles the instantiation and passing of the required parameters, direct calls to Pages::record() need to be updated accordingly.

Here’s how you can adjust your code to accommodate the new method signature:

$visitorProfile = new \WP_Statistics\Service\Analytics\VisitorProfile();
\WP_STATISTICS\Pages::record($visitorProfile);

If you have any further questions or need additional assistance, please don’t hesitate to reach out.

Best

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer