Make WordPress Core

Opened 4 years ago

Last modified 6 months ago

#27631 new enhancement

make "comment-page" slug configurable

Reported by: qdinar Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.8
Component: Comments Keywords: dev-feedback close
Focuses: Cc:


make "comment-page" slug configurable

Attachments (2)

27631.diff (5.3 KB) - added by jesin 4 years ago.
Add a wp rewrite variable $comments_pagination_base
27631.2.diff (6.4 KB) - added by jesin 4 years ago.
Renames /comment-page-n/ to /comment-page/n/ and redirects old URL

Download all attachments as: .zip

Change History (17)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Comments

4 years ago

Add a wp rewrite variable $comments_pagination_base

#2 @jesin
4 years ago

  • Keywords has-patch added

The patch adds a variable named $comments_pagination_base to the WP_Rewrite class.

The following code modifies the 'comment-page' slug.

add_action( 'init', 'rename_comment-page_slug' );

function rename_comment-page_slug() {
	$GLOBALS['wp_rewrite']->comments_pagination_base = 'foobar';

#3 @qdinar
4 years ago

i have found a mistake here only now when i have started to read the patch. it is well known mistake in internationalisation. position of the page number should be changeable. for that "%s" code is used in internationalisation and localisation.

#4 @qdinar
4 years ago

i have been thinking and writing just now "but in this case page number position at end is at the general flow of slugs: from outer level to inner level: /year/month/day/post-name/page-number/comment-page-number/" - but this is also mistake because the slugs order may be changed in the wp-admin/options-permalink.php: there are %year% %monthnum% %day% %postname% codes are used, same code for comment slug should be added. (and also it is mistake because in the logic of the general flow from outer to inner, the page number should be separated with slash, not by hyphen).

and i have seen now, seems this slug should be configured in that place in admin area, and only something like %comment-page-num% is needed.

also post page slug should be configurable. probably new ticket should be made for this.

4 years ago

Renames /comment-page-n/ to /comment-page/n/ and redirects old URL

#5 @jesin
4 years ago

  • Keywords dev-feedback added

What is the purpose of a permalink tag for pagination? The "outer to inner" inner URL structure makes more sense.

I do not know if there was a purpose behind comment-page-n instead of comment-page/n/. Maybe a core developer can comment on this.

#6 @qdinar
4 years ago

"What is the purpose of a permalink tag for pagination?"

it is for long posts to show 1st part in the front page of the post page , then it haves 1 2 3 etc links in bottom of the post part 1 and also in post part N pages below post text and above comments. all comments in several pages of post are same comments.
that is like unrelated to comments, but it has similar problem that slugs of it are not configurable.

Last edited 4 years ago by qdinar (previous) (diff)

#7 @qdinar
4 years ago

"Attachment 27631.2.diff​ added"

"$wp_rewrite->comments_pagination_base . '/' . $pagenum"

but if you look at wp-admin/options-permalink.php, it is totally configurable... "outer to inner" is just default configuration.

default is %year%/%monthnum%/%day%/%postname%

it is probably possible to make it


#8 @qdinar
4 years ago

" it is probably possible to make it

%postname%-written-in-%day%-of-%monthnum%-of-%year% "

it is possible, i have tested it now

#9 @qdinar
4 years ago

about pagination:

"On most well-coded themes, all you have to do is paste this code: <!––nextpage––> wherever you want the next page to start." - http://www.wpbeginner.com/wp-tutorials/how-to-split-wordpress-posts-into-multiple-pages/

maybe http://codex.wordpress.org/Pagination is helpful

#10 @qdinar
4 years ago

" <!––nextpage––> " - it does not work in default (built-in, official) themes (twenty eleven etc)

#11 @chriscct7
2 years ago

  • Version changed from 3.8.1 to 3.8

#12 @qdinar
2 years ago

" %postname%-written-in-%day%-of-%monthnum%-of-%year% ... it is possible, i have tested it now " - but, comments slug cannot be inside this, because it can be "void", also post pagination slug can be void. so, they should be 1) either after slash, and the slug after slash can be configurable with sprintf-like syntax, 2) either there should be several special strings with sprintf-like syntax, for cases with and without comments and post pagination, and, 2.1) they can be also several for different numbers, like in gettext...

#13 @qdinar
2 years ago


i think /comment-page/n/ is good temporary fix.


" What is the purpose of a permalink tag for pagination? "

-- it is also needed to translate it. (i have already said about changing position and customizing).

also it should/can be added to /wp-admin/options-permalink.php

and gettext functions should/can be added so that comment-page slug becomes translated automatically .

#14 @qdinar
2 years ago

i said " i think /comment-page/n/ is good temporary fix " , but it can be also left so forever, if nobody needs configuring it so that comment page number is at beginning (or middle) of address path.

#15 @dimadin
6 months ago

  • Keywords close added; has-patch removed

Is this fixed in [31459] for #18084?

Note: See TracTickets for help on using tickets.