Support » Plugin: WordPress Popular Posts » Not working with WordPress 5.6

  • Resolved otterreviews

    (@otterreviews)


    Hi,

    today I updated WordPress to the latest version, 5.6 Since, this plugin has stopped working. It doesn’t count the views anymore, nor does it show the results (not even the old ones).

    Cheers,
    Matic

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @otterreviews,

    I checked your website and noticed that WPP’s JS file is not being loaded by it. Said JS file is what WPP uses to track post/page views, load the popular post list on your website, etc.

    Upon checking the source code of your website it seems that you’re using AMP, if so please read here: WordPress Popular Posts’ compatibility with Google’s AMP.

    Thread Starter otterreviews

    (@otterreviews)

    You’re absolutely correct! I am such a mo*on, I forgot that I once again enabled AMP. Sorry for that. You’re doing a great job.

    Cheers

    aliciarodriguez

    (@aliciarodriguez)

    Hello,
    In my case I am basically trying the plugin on my own-developed theme, which is at the moment really basic.
    I have WordPress 5.6 installed and the deprecation notices show up:

    Deprecated: Required parameter $thumbnail follows optional parameter $public_options in C:\xampp\htdocs\wordpress\wp-content\plugins\wordpress-popular-posts\src\Output.php on line 88
    
    Deprecated: Required parameter $translate follows optional parameter $public_options in C:\xampp\htdocs\wordpress\wp-content\plugins\wordpress-popular-posts\src\Output.php on line 88
    
    Deprecated: Required parameter $themer follows optional parameter $public_options in C:\xampp\htdocs\wordpress\wp-content\plugins\wordpress-popular-posts\src\Output.php on line 88
    
    Deprecated: Required parameter $rating follows optional parameter $data in C:\xampp\htdocs\wordpress\wp-content\plugins\wordpress-popular-posts\src\Output.php on line 789

    I am not using AMP, I am basically using no plugins at all.
    The only plugin used is this one.

    It seems to come from new PHP requirements, especially from PHP 8.0.
    Copied and pasted here:
    When declaring a function or a method, adding a required parameter after optional parameters is deprecated since PHP 8.0.

    I applied the following solution. Instead of this line of code:

    public function __construct(array $public_options = [], array $admin_options = [], Image $thumbnail, Translate $translate, \WordPressPopularPosts\Themer $themer)
        { .. }

    I used this one:

    public function __construct(array $public_options = null, array $admin_options = null, Image $thumbnail, Translate $translate, \WordPressPopularPosts\Themer $themer)
        { .. }

    The same applies to the line of code number 789. However, I coudn’t make it work. So, since it is called just once, I change the order of the parameters and now it works.

    Maybe it’s worth changing the parameters from their place to other within the interface of the function.

    I hope this helps.

    Great job with this plugin.
    Regards,
    Alicia

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Oh I haven’t tested the plugin with PHP 8 yet so this is interesting stuff @aliciarodriguez, thanks for sharing (and for the compliment!)

    Seems like I have some research / work to do 😛

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Not working with WordPress 5.6’ is closed to new replies.