• Resolved aapc

    (@aapc)


    After updating to v6.4.0 I’m seeing a bunch of warnings in my PHP log related to WPP. Here’s what I’m seeing:

    PHP Warning: The /wordpress-popular-posts/v1/popular-posts POST endpoint has been deprecated, please POST to /wordpress-popular-posts/v2/views/[ID] instead. in /xxxx/xxxx/xxxxxxx/xxxxxxxxxx.com/public/wp-content/plugins/wordpress-popular-posts/src/Rest/ViewLoggerEndpoint.php on line 91

    x’s were added for security ??

    • This topic was modified 9 months, 4 weeks ago by aapc.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @aapc,

    That PHP warning is intentional, and will show up on your log if:

    • You have some custom JS code POSTing to /wordpress-popular-posts/v1/popular-posts to update views count, or
    • You’re using a caching plugin on your site and your site is serving an outdated version of wpp.min.js

    If it’s the first one then you’ll need to update your JS code so POST requests are sent to /wordpress-popular-posts/v2/views/[ID] (where ID would be the post / page / CPT ID).

    If you’re not running any custom code but you have a caching plugin installed on your site then clearing its cache should make sure that your site is serving the latest wpp.min.js script which does use the new endpoint.

    Thread Starter aapc

    (@aapc)

    I had cleared the WP Rocket cache after updating the plugin but after clearing the cache from the hosting control panel, the warnings seem to have stopped. Thanks for the help and I appreciate the quick response!

    Since src/Front/Front.php contains logic that accesses the following outdated URL, wouldn’t it constantly trigger a deprecated warning, even when the widget is simply being called as usual?

    ‘ajax_url’ => esc_url_raw(rest_url(‘wordpress-popular-posts/v1/popular-posts’)),”

    Plugin Author Hector Cabrera

    (@hcabrera)

    No, it won’t @hykw. That is still in there on purpose as the referred endpoint has been deprecated, not removed (yet.) The only scenarios where that PHP warning might popup on your log are the ones I mentioned above.

    Thank you, I’ve found the reason, which was the browser cache.

    Details:
    During the recent update (on my WordPress site, not in the plugin’s logic), the assets/js/wpp.min.js file was updated. The obsolete file that was cached in the browser had pointed to /v1/. Clearing the browser cache has resolved the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Deprecated REST Endpoint’ is closed to new replies.