• Resolved rask44

    (@rask44)


    Hi,

    When I use the function “wpp_get_mostpopular”, I receive ‘NULL’. This function has been working for a year, it seems to have stopped working after the last update.

    My code:

        $popularPostStr = wpp_get_mostpopular(array(
            'limit' => 5,
            'range' => 'last7days',
        ));

    Info from debug page:

    Plugin Configuration
    
    Performance Nag: Dismissed
    
    Log Limit: No
    
    Log Views From: Everyone
    
    Data Caching: Yes, 1 minute
    
    Data Sampling: No
    
    External object cache: No
    
    WPP_CACHE_VIEWS: No
    System Info PHP version: 7.4.27 PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, apache2handler, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, json, exif, memcache, msgpack, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache Database version: 10.5.15-MariaDB-0ubuntu0.21.10.1 InnoDB availability: DEFAULT WordPress version: 6.3 Multisite: No Active plugins: a3 Lazy Load 2.7.0, ACF Content Analysis for Yoast SEO 3.1, Add From Server 3.4.5, Advanced Custom Fields PRO 6.2.0, Advanced Editor Tools 5.9.2, Announcer 5.9, Classic Editor 1.6.3, Cloudflare 4.12.2, Contact Form 7 5.8, Custom field finder 0.3, Custom Post Type UI 1.14.0, Disable Comments 2.4.4, Drag and Drop Multiple File Upload - Contact Form 7 1.3.6.9, Duplicate Page 4.5.2, Health Check & Troubleshooting 1.7.0, Honeypot for Contact Form 7 2.1.1, InfiniteWP - Client 1.12.3, Missed Scheduled Posts Publisher by WPBeginner 1.0.1, plugin load filter 4.0.15, PublishPress Authors Pro 4.1.7, PublishPress Capabilities 2.9.1, PublishPress Capabilities Pro 2.9.1, PublishPress Checklists Pro 2.6.0, PublishPress Planner Pro 3.12.0, PublishPress Revisions Pro 3.4.1, Redirection 5.3.10, Regenerate Thumbnails 3.1.6, Search & Replace 3.2.1, Velvet Blues Update URLs 3.2.10, Wordfence Security 7.10.3, WordPress Popular Posts 6.2.1, WP Mail SMTP 3.8.2, WPS Hide Login 1.9.8, Yoast SEO 20.13, Yoast SEO Premium 20.13, Yoast Test Helper 1.17

    Thank you.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @rask44,

    Sorry for the late reply, didn’t have time to test until now.

    I copied and pasted your code almost as is (and I say “almost” because wpp_get_mostpopular() doesn’t return posts, the function echoes them) and for me the list is loading normally on my test site (latest WordPress version, PHP 7.4.16).

    Let’s try this:

    1. Enable the Debug Log on your site (you don’t need to use SCRIPT_DEBUG for this).
    2. Go to Plugins > Plugin File Editor and select WordPress Popular Posts.
    3. Click on src > Output.php to edit this file.
    4. Replace the contents of Output.php with this version.
    5. Click on Update File to save changes.
    6. Visit the page where your popular posts should render via wpp_get_mostpopular().
    7. Upload the contents of your debug.log file somewhere (eg. Pastebin) and share the link here so I can have a look.
    Thread Starter rask44

    (@rask44)

    Hi,

    Thanks for your reply.

    Here are logs from debug mode https://pastebin.com/rXGEcQEG

    Plugin Author Hector Cabrera

    (@hcabrera)

    Well, it seems to be working as expected. HTML code is being returned according to the log. Are you still using version 6.2.1?

    Thread Starter rask44

    (@rask44)

    Yes, I use version 6.2.1.

    When I check Setting page in admin: settings -> “WordPress Popular Posts” – it looks good, but on the website I have “Sorry. No data so far”

    Plugin Author Hector Cabrera

    (@hcabrera)

    That sounds like a different issue. Could you please share your site’s URL so I can have a look?

    Thread Starter rask44

    (@rask44)

    Sure, here is subpage with only “wpp_get_mostpopular”

    https://www.dailyartmagazine.com/test/

    Thread Starter rask44

    (@rask44)

    Hi,

    Do you perhaps have an idea why I am receiving the message “Sorry. No data so far.”?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @rask44,

    Sorry for the lack of replies. I did check your site the other day but got super busy and couldn’t research more.

    I’ll leave a comment here later today to ask you to help further debug this so I can understand what’s going on.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, let’s try this next:

    1. Make sure that the Debug Log is enabled.
    2. Go to Plugins > Plugin File Editor and select WordPress Popular Posts.
    3. Click on src > Query.php to edit this file.
    4. Replace the contents of Query.php with this version.
    5. Click on the Update File button to save changes.
    6. Visit https://www.dailyartmagazine.com/test/ at least once.
    7. Upload the contents of your debug.log file somewhere (eg. Pastebin) and share the link here so I can have a look.
    Thread Starter rask44

    (@rask44)

    Done. Here is new debug info: https://pastebin.com/GReFa62d

    Thanks.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey @rask44,

    Looks like you shared the old debug log? The one from my previous comment should contain different info. Please double check that you updated the Query.php file as instructed above.

    Thread Starter rask44

    (@rask44)

    Hi,

    Sorry, please check this https://pastebin.com/Equkj0Vm

    Plugin Author Hector Cabrera

    (@hcabrera)

    According to the log your popular posts list is being sorted by the most commented posts from the last 7 days:

    Array
    (
        ...
        [range] => last7days
        ...
        [order_by] => comments
        ...
    )

    but the code you shared above seems to indicate you’re sorting posts by views? Did you change it afterwards?

    Also, has your site received any comments within the last 7 days?

    Thread Starter rask44

    (@rask44)

    Hi,

    Yes, you’re right, it is a problem, however, I think I’ve tested it with different parameters before :/ Thanks.

    However, I have an issue with displaying the list of popular posts using my own styles. Is it possible to retrieve just the post IDs based on their popularity?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Let’s work on one thing at a time, please.

    Change your order_by parameter value back to 'views' (or remove the parameter completely), visit your test page again and if you still get null share your log here.

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘wpp_get_mostpopular return NULL’ is closed to new replies.