WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#31100 closed defect (bug) (invalid)

Comment reply link and cancel comment reply link broken in 4.1

Reported by: ericabiz Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Comments Keywords: reporter-feedback needs-testing
Focuses: Cc:
PR Number:

Description

Using latest 4.1 of WordPress. Our "reply" comment links are broken. The "cancel comment reply" link is also broken. Neither link contains the /blog part of our URL. See http://help.com/blog/2015/01/15/12-best-customer-service-phrases/#respond for an example -- click "Reply" beneath either of the comments there.

Both of these links are generated directly by wp-includes/comment-template.php.

This happens on any theme, including the 2015 theme direct from WordPress and with all plugins disabled. Our current theory is that this is happening because our WordPress Address and Site Address are different. See http://imgur.com/kaOOqZe for a screenshot from our settings page.

Here is the code from when we activated the 2015 theme on our site:

<h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/2015/01/15/12-best-customer-service-phrases/#respond" style="display:none;">Cancel reply</a></small></h3>

Notice the lack of /blog at the beginning of the href.

We posted in your support forms and James Huff referred us over here, so here we are!
https://wordpress.org/support/topic/possible-bug-comments-reply-link-is-broken?replies=3#post-6469255

Change History (7)

#1 @johnbillion
5 years ago

  • Keywords reporter-feedback needs-testing added

I've tested this on a fresh setup with Twenty Fifteen enabled and no plugins active. The site uses the following URL/folder structure:

https://i.imgur.com/e33g1FW.png

I can't reproduce the problem. Both the reply and the cancel reply buttons have correct URLs.

Additionally, I can see no reason why the URLs would be incorrect, because they both just use add_query_arg() which uses the current URL and is unconnected to the site URL or the WordPress URL.

Some things to look at:

  • Are there any plugins in your mu-plugins directory which might be interfering?
  • Are there any funky settings in your .htaccess file (if relevant)?
  • Is this a multisite setup?

#2 follow-up: @SergeyBiryukov
5 years ago

I've set up an install with similar home and siteurl values, but could not reproduce the issue.

As noted above, get_cancel_comment_reply_link() uses remove_query_arg(), which ultimately depends on $_SERVER['REQUEST_URI'].

Could you see what is the value of $_SERVER['REQUEST_URI'] on that page?

#3 in reply to: ↑ 2 ; follow-up: @suitupalex
5 years ago

Hi Sergey. I'm one of the engineers at Help.com and I'm taking a peek at this.

I've got a hard coded, temporary fix in place that simply prepends '/blog' when building the link in get_comment_reply_link().

When I log out $_SERVER['REQUEST_URI'] I see something along the lines of '/2015/01/15/blog-title-here/'.

Replying to SergeyBiryukov:

I've set up an install with similar home and siteurl values, but could not reproduce the issue.

As noted above, get_cancel_comment_reply_link() uses remove_query_arg(), which ultimately depends on $_SERVER['REQUEST_URI'].

Could you see what is the value of $_SERVER['REQUEST_URI'] on that page?

#4 in reply to: ↑ 3 @johnbillion
5 years ago

Replying to suitupalex:

When I log out $_SERVER['REQUEST_URI'] I see something along the lines of '/2015/01/15/blog-title-here/'.

This sounds like a server configuration issue in that case. $_SERVER['REQUEST_URI'] should contain the full path of the request. I suspect this is due to the way you have the web server configured.

Can you provide some information about your web server configuration? Which web server are you running? How are help.com/blog and blog-vhost.help.com set up?

#5 @rachelbaker
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I was also unable to reproduce this reported bug. Sounds like this was a server configuration issue.

#6 @henry.wright
3 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I hope you don't mind me revisiting this.

I can reproduce this issue if I'm using a custom comment callback. For example, here's my call to wp_list_comments():

wp_list_comments( array(
    'style'    => 'ul',
    'callback' => 'mytheme_comment'
) );

If I don't use a custom comment callback, I can then see the reply and cancel links on the page.

Last edited 3 years ago by henry.wright (previous) (diff)

#7 @henry.wright
3 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

Of course you must output the reply link in your callback function. I'm closing this, my apologies for opening.

Note: See TracTickets for help on using tickets.