Page 1 of 1

UPDATE: WordPress 5.x – Reply Comment button fix (addComment.moveForm)

UPDATE: WordPress 5.x – Reply Comment button fix (addComment.moveForm)

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Website Updates UPDATE: WordPress 5.x – Reply Comment button fix (addComment.moveForm)

This topic contains 0 replies, has 1 voice, and was last updated by  hans 3 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • 11613

    hans
    Keymaster

    Unfortunately, after the update to WP 5.1, the Reply to comment button no longer moved the comment field below the comment you’d like to reply to.
    This has been fixed. For those with a similar problem in WordPress 5.x;

    It seems that the get_comment_reply_link no longer works properly, or maybe I should say “screwed up” the way addComment.moveForm works.
    I fixed this by adding a string replacement in the comment_callback($comment, $args, $depth) function, simply adding the old function incase the new function appeared.

    Effectively replacing:

    data-belowelement="comment-form-here-212086" data-respondelement="respond"

    with the onclick inserted:

    data-belowelement="comment-form-here-212086" onclick="comment-form-here-212086" onclick="return addComment.moveForm( 'comment-form-here-212086', '212086', 'respond', '178' )" data-respondelement="respond"

    PHP Code in functions.php, for the comment call-back:

    $replyButton = str_replace( 'data-belowelement', 'onclick="return addComment.moveForm( \'comment-form-here-'.get_comment_ID().'\', \''.get_comment_ID().'\', \'respond\', \''.get_the_ID().'\' )" data-belowelement', $replyButton);
    echo $replyButton;

    This way the change will only happen when the new method seems to be there, and the new method (if it would ever work in my theme) would still be there as well.

Viewing 1 post (of 1 total)



You must be logged in to reply to this topic.