Make WordPress Core

Opened 14 years ago

Last modified 6 years ago

#17183 new defect (bug)

previous_comments_link and next_comments_link return wrong url with PATHINFO permalinks

Reported by: firemotion's profile FireMotion Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Permalinks Keywords: has-patch needs-unit-tests dev-feedback
Focuses: Cc:

Description

When using PATHINFO permalinks, previous_comments_link() and next_comments_link() return a wrong link, which renders paged comments useless.

Steps to reproduce:
Set permalinks to: /index.php/%post_id%/%postname%/

The functions return URLs similar to: /comments-page-1/#comments
This URL results in a file not found (if no rewrite rules are available, which should not be necessary if the PATHINFO permalink structure is used).

Expected URL: /index.php/comments-page-1/#comments
Manual opening the URL results in the expected/correct paged comments page.

Attachments (1)

17183.patch (729 bytes) - added by c3mdigital 12 years ago.

Download all attachments as: .zip

Change History (14)

#1 @Viper007Bond
14 years ago

Correct URL would be /index.php/123/post-name/comments-page-1/#comments, not the URL described.

#2 @solarissmoke
14 years ago

  • Keywords reporter-feedback added

If I set permalinks to

/index.php/%post_id%/%postname%/

And I go to a post with comments, the previous comment link points to:

http://localhost/wp/index.php/26/hello-world/comment-page-1/#comments

Which works fine. Can you clarify what your actual and expected links are?

#3 @FireMotion
14 years ago

My apologies, I now realize some information is missing:

I'm using a static page as my front page (and am not using any posts).

I'm guessing this is the cause of the problems (and it's confirmed working on other pages that are not the front page).

Version 0, edited 14 years ago by FireMotion (next)

#4 @FireMotion
14 years ago

  • Keywords reporter-feedback removed

#5 @Viper007Bond
14 years ago

Ah, so index.php is missing from the comment page links on the static page homepage. Got it.

#6 @FireMotion
14 years ago

Viper007Bond: Your summary is correct.
"index.php" is missing from the comment page links, when using paged comments, a static page and PATHINFO permalinks.

#7 @SergeyBiryukov
14 years ago

  • Keywords needs-patch added

#8 @c3mdigital
12 years ago

  • Version changed from 3.1.1 to 1.5

This is caused by get_page_link()

	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
		$link = home_url('/');

Patch adds a check for got_mod_rewrite() and if false prepends the permalink with index.php.

@c3mdigital
12 years ago

#9 @c3mdigital
11 years ago

  • Keywords has-patch added; needs-patch removed

#10 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#11 @wonderboymusic
11 years ago

  • Keywords needs-unit-tests added

Let's find a way to unit test this

#12 @nacin
11 years ago

  • Milestone changed from 3.7 to Future Release

This doesn't look like the right place for a fix. Also, $wp_rewrite has the ability to return the pathinfo prefix — this can't be hardcoded.

#13 @chriscct7
9 years ago

  • Keywords dev-feedback added
Note: See TracTickets for help on using tickets.