Solve the problem that QueryString cannot be correctly transmitted through the paging link generated by the WP-PageNavi plug-in.

Source: Internet
Author: User
Solving the problem that QueryString cannot be correctly transmitted through the pagination link generated by the WP-PageNavi plug-in seems to have exploded recently. a customer reported that a bilingual website based on WPML was deployed, the English version list page does not work. clicking the second page will jump to the website homepage. After checking, it is found that the problem is locked on the page of the custom article type and only occurs in the English version. the default Chinese version of the website does not have this problem. This website adds Query String-"lang = en" to the URL of the English version, and WP-PageNavi changes the paging link to this "http://xxx.com? Lang = en/category/greece/page/2"

I remember that when the website was just developed, WPML and WP-PageNavi of the current version had a good combination. this was not a problem, and I did not know which plug-in had caused this compatibility problem after it was updated, there is no way to trace it. it seems that you have to solve it by yourself. My solution is rough, mainly because I have no skills and don't want to find problems from the plug-in. I just need to modify the position of the Query String on the front end, this JS code is placed at the bottom of the page that calls the wp_pagenavi function. you can also put it in footer. php:

$ (Function () {$ (". wp-pagenavi "). each (function () {tempvelue = $ (this ). attr ("href"); if (tempvelue. indexOf ("? Lang = en ")> 0) {tempvelue = tempvelue. replace ("? Lang = en "," ") + "? Lang = en "; $ (this). attr (" href ", tempvelue );}});});

This problem may also occur on other pages with a URL with a Query String. you can modify the above code to solve this problem. Therefore, it is more likely that the problem of WP-PageNavi can be solved through future updates.

If anyone knows the solution on the PHP layer, please kindly advise.

All the articles on this site are original, welcome to reprint, but please note the source of the article: http://blog.brain1981.com/1348.html

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.