WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some very long posts, some have more than 50 pages() and when using wp_link_pages it give me 50 internal post links, clearly this isn't usable.

How can I add a range to the wp_link_pages function?

The output should look like this: ...45*6*78...

UPDATE 10/1/2012:

I've got the logic for adding the range but now I need to figure out how to add it to the existing wp_link_pages function?

Here is the example function:

function limitPagination(){
    $displayPages = 5;
    $firstPage = 1;
    $lastPage = $numpages > 5;

    while($numpages > $displayPages){
        if(($pageNow > $firstPage +2) && ($pageNow < $lastPage - 2)){
                echo (($pageNow - 2).($pageNow - 1).$pageNow.($pageNow + 1).($pageNow + 2));
share|improve this question
Did you ever figure this out? I'm looking for the same thing. – kel Jun 21 '13 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.