Manually solve the WordPress wp-postviews problem with Ajax _ajax related

Source: Internet
Author: User

A Web site opened the memcached and installed the wp-postviews, but did not know how the browsing count of the article did not work.

After some groping, it was found that Wp-postviews was sent through Ajax to count the requests. Another look at the problem of the site, simply send this request.

After a few WordPress background settings and Plug-ins groping, still did not find the reason.

Helpless, resorted to the ultimate killer, oneself manually add this request script, add 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 is described in this article to you through AJAX manual solution WordPress wp-postviews do not count the problem, I hope you like.

Related Article

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.