Make WordPress Core

Opened 6 years ago

Closed 2 months ago

#10203 closed enhancement (wontfix)

posts_nav_link ignoring blank function parameters

Reported by: milanmk Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Posts, Post Types Keywords: posts_nav_link
Focuses: template Cc:


posts_nav_link shows both next and previous links including link seperator even though the respective function parameters are blank.

<div id="page-nav-prev"><?php posts_nav_link('', '&#171; Previous Page', '') ?></div>
<div id="page-nav-next"><?php posts_nav_link('', '', 'Next Page &#187;') ?></div>

Attachments (1)

link-template-10203-1.diff (518 bytes) - added by nikolov.tmw 7 months ago.
Removes array_filter(), which preserves the arguments even when they are empty.

Download all attachments as: .zip

Change History (8)

#1 @Denis-de-Bernardy
6 years ago

  • Component changed from General to Template
  • Milestone changed from Unassigned to Future Release
  • Type changed from defect (bug) to enhancement

see #10204

#2 @milanmk
6 years ago

  • Cc milanmk@… added

#3 @jeremyclark13
6 years ago

A workaround for now is to set the paramaters to a blank space.

<?php posts_nav_link(' ',' ','&laquo; Older Entries') ?>
<?php posts_nav_link(' ','Newer Entries &raquo;',' ') ?>

#4 @chollaball
5 years ago

Issue still occurs in v 3.0. Did not occur in v 2.7. I would classify as a bug not an enhancement since it used to work. Workaround as described above is still valid.

#5 @nacin
22 months ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

7 months ago

Removes array_filter(), which preserves the arguments even when they are empty.

#6 @nikolov.tmw
7 months ago

I've attached a patch that fixes the issue. However I see a problem with backwards-compatibility in that approach(which was to just remove array_filter()).

Thinking about it, I'm not sure if there's a good backwards-compatible fix for that issue.

#7 @wonderboymusic
2 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

These functions are unused by core, there is no use writing a bunch of hairy logic for them to ensure BC.

Note: See TracTickets for help on using tickets.