Use Ajax to manually solve the problem that WordPress WP-PostViews does not count, wordpresspostviews

Source: Internet
Author: User

Use Ajax to manually solve the problem that WordPress WP-PostViews does not count, wordpresspostviews

A website has enabled Memcached and installed WP-PostViews. However, you do not know that the browser count of some articles does not work.

After some exploration, we found that WP-PostViews was counted by sending requests via ajax. The website that saw the problem simply sent the request.

After some exploration of wordpress background settings and plug-ins, I still cannot find the reason.

In desperation, add the script for this request manually to the bottom of the page. The Code is as follows:

<?php if  (is_singular()) : ?>  <!-- ajax post view -->  <script type= "text/javascript" >   $.ajax({    url: "http://***.com/wp-admin/admin-ajax.php" ,    data: {     "postviews_id" : "<?php the_ID(); ?>" ,     "action" : "postviews" ,     "_" : new  Date ().getTime()    }   });  </script><?php endif ; ?>

The above section describes how to manually solve the problem of WordPress WP-PostViews not counting through Ajax.

Articles you may be interested in:
  • Using AJAX to asynchronously retrieve comments to user portraits in WordPress
  • How to Use PHP + AJAX to allow WordPress to dynamically load articles
  • Use CDN and AJAX to accelerate jQuery loading in WordPress
  • How can I solve the problem when I use wordpress's $ wpdb class to read mysql database for ajax?
  • Optimize time display of articles and comments in WordPress
  • Detailed description of PHP functions that call comment templates and output comments cyclically in WordPress
  • WordPress restricts non-administrator users to comment only once after the article
  • Describes the PHP functions used in WordPress to obtain comment templates and search forms.
  • Solve the problem that WordPress cannot comment after using CDN
  • Use jQuery to implement @ ID floating display of comments in WordPress
  • Compile a PHP script to implement the comment paging function in WordPress
  • Example of modifying the PHP script to enable WordPress to intercept spam comments
  • Customize the default comment Avatar and delay loading in WordPress
  • Some methods to optimize guest comment in WordPress
  • Implementation example of comments submission using AJAX technology in WordPress

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.