lesterchan / wp-postviews

Enables you to display how many times a post/page had been viewed.
https://wordpress.org/plugins/wp-postviews/
114 stars 42 forks source link

Displays the Ajax option even if WP_CACHE is false #28

Closed SGr33n closed 6 years ago

SGr33n commented 8 years ago

As discussed on the support forum, there are caching methods that doesn't require WP_CACHE to be true. Think of Nginx FastCGI cache, or to Redis. To understand the importance for your plugin to be compatible with Nginx just think at the wordpress.org server, that is right Nginx. This will enable the Ajax options for everyone, even if WP_CACHE is false, that is not so bad.

Thanks!

lesterchan commented 8 years ago

I am hesitant to change this because the default behaviour is use_ajax = 1 https://github.com/lesterchan/wp-postviews/blob/master/wp-postviews.php#L957, so if this is released, the default behaviour will change for uses who are not using cache. when the page refresh, there will not be a +1 increment immediately as the ajax happens after the page is loaded.

Not sure what is the best way of doing it. Maybe have a filter to overwrite it for developers while keeping the existing behaviour will be a better way.

SGr33n commented 8 years ago

Hi, a filter could be ok, but think about it. I consider that today websites, without JavaScript, would not work at all, and the possibility that a user doesn't have Ajax working is pretty low, so having Ajax as default could be a better choice. Then, working asynchronously, the impact on the performance is also better.

lesterchan commented 8 years ago

Yea I understand that AJAX is better but the thing is it would change the behaviour of the plugin that has not been change for years. A good example is they will get lesser views because if search engine bots crawl on the site, the AJAX request will not be sent.

SGr33n commented 7 years ago

I see you made it, good ;)