Website construction

Solve the problem that the comment box does not follow and the page is refreshed after upgrading WordPress 5.1

Jager, March 22, 2019 4132 times read

Recently, I found many problems in the blog. First, I found that the picture black box and the JS QR code were invalid. Then, I clicked the reply button to refresh the page directly, but there was no comment box to follow the effect. Today, even the CSS icon on the website was hung...

I couldn't bear it. I decided to take a moment to see what the problem was. I didn't find an obvious error when I opened F12. Since it was the CSS icon hanging, it should be that there was a problem with the CSS address of my external link to fontawesome. So I filtered the address and found it was 301??

Similar situations are as follows: Solve the problem that the comment box does not follow and the page is refreshed after upgrading Wordpress 5.1

it turns out to be the case that cdn.bootcss.com CDN resources of all jump to cdnjs.com Home page (this practice is a little drunk), and many functions of my blog have quoted this CDN, so it is abnormal!

Finally, a replacement CDN was found: https://cdnjs.net/ After the replacement, the functions such as image black box, QR code, CSS icon and delayed loading are restored, but the comment reply button is still refreshed abnormally!

Finally, I talked with Brother Bird. He said that it was the upgrade of WordPress to 5.1.1. After searching on the Internet, I found that I was out. Many blogs have provided solutions, such as Yigujin blog:《 What if the WordPress 5.1 comment reply button fails and the comment box does not follow? 》。

However, Brother Bird gave me a simpler solution (to avoid the trouble of refreshing CDN cache and browser cache):

For the start topic, directly find the zmingcx_scripts function in functions.php, and add the following before the last}:

 //Load reply js if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }

This code actually loads a JS on the page:

 <script type='text/javascript' src='/wp-includes/js/comment-reply.min.js? ver=5.1.1'></script>

Therefore, for non start topics, just add the following code to the topic header.php:

 <? php if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { ?> <script type='text/javascript' src='/wp-includes/js/comment-reply.min.js? ver=5.1.1'></script> <? php } ?>

This will solve the problem!

25 responses
  1. Long Xiaotian 2019-3-22 · 15:39

    Zan Yiyi has just found this problem and has solved it according to the method in the article~: mrgreen:

    •  avatar
      Jager 2019-3-22 · 18:23

      Your jump page is good. Recently, my blog was hacked by QQ and WeChat. After internal inquiry, I didn't give the reason. I guess that some reviewers' website links had illegal content reported. At present, all reviewers' hyperlinks have been temporarily cancelled. I'm trying to get a hint like yours. I don't know if it would be better. At least don't report me. It's not my website...

      • Long Xiaotian 2019-3-28 · 21:21

        : oops: Yes, it's better to add a jump middle page~PS: Why is there no comment reply email reminding~

  2. Feng Yan Feng Yu 2019-3-22 · 15:58

    I also upgraded to 5.1.1, no problem!

    •  avatar
      Jager 2019-3-22 · 18:12

      Have a look, because your theme itself has loaded the required files: https://www.fengsay.com/wp-includes/js/comment-reply.min.js?ver=5.1.1 , it is estimated that the robin has been updated and repaired later.

      • Feng Yan Feng Yu 2019-3-23 · 8:14

        The jump link of the visitor's comment name is gone!

        •  avatar
          Jager 2019-3-24 · 9:17

          Any comments?: mrgreen:
          Look at my reply above.

  3. lush mountain 2019-3-22 · 16:10

    Wp update bugs frequently appear

  4. Four Heavenly Kings 2019-3-23 · 12:51

    Blogger, is your theme a robin? The mobile phone experience is good

  5. lush mountain 2019-3-24 · 18:35

    The official theme used to have no effect. Now I find this bug by changing the theme. Thank you for your tutorial.

  6. I love Technet 2019-3-25 · 17:10

    It has been solved according to the method in the article. Thank you

  7. Lu Songsong Blog 2019-3-26 · 17:01

    The article is well written with support

  8. test 2019-3-29 · 2:16

    Test, brother

  9. simple life 2019-3-30 · 9:42

    I didn't find anything inappropriate: mrgreen:

  10. DC water pump 2019-4-1 · 15:13

    Thanks for sharing, and finally found a solution.

  11. Aestheticism 2019-4-6 · 0:16

    I am used to using 4.9,: mrgreen:: mrgreen:: mrgreen:

  12. Computer failure 2019-4-6 · 15:25

    My version also made a mistake. I simply removed the comments, and several updates went wrong. Either here or there.

  13. You Yi's Random Notes 2019-4-6 · 18:50

    Grab a bench to do ha ha

  14. I always feel that wp is too complicated

  15. Grey memory 2019-4-11 · 2:55

    I used your last code, but it didn't work?

  16. www.qian.lu 2019-4-17 · 18:28

    Why don't I refresh the comments after I reply to my blog? There is no silly response, but actually it has been submitted successfully

  17. VIVO mobile phone unlocking 2019-4-21 · 23:27

    Technical problems, no in-depth study, no time to find someone to solve. Can save a lot of time to do other things

  18. Mingyue Cloud Service 2019-4-26 · 21:48

    I seem to have this problem too!

  19. Software library 2019-5-7 · 20:44

    Wp makes people exhausted

  20. 365cent 2019-7-14 · 18:41

    Boss, there seems to be a problem with your comment box now. The page will shake with every word you lose. It's a bit confusing