WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#30440 closed enhancement (fixed)

{$adjacent}_post_link filter should pass $adjacent variable itself as parameter.

Reported by: ankit.gade@… Owned by: SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 2.6
Component: Posts, Post Types Keywords: has-patch commit
Focuses: Cc:

Description

{$adjacent}_post_link filter should pass $adjacent variable itself as parameter to the callback function. This will be useful in scenario where I am using same callback function for previous_post_link and next_post_link filters.

If this variable is not passed, I will be unable to determine whether given post is previous or next to current post. Moreover, I will have to write nearly same code twice.

Attachments (3)

link-template.diff (482 bytes) - added by ankit.gade@… 6 years ago.
link-template-with-doc.diff (635 bytes) - added by ankit.gade@… 6 years ago.
The new parameter added in docblock
30440.3.diff (1.0 KB) - added by kpdesign 6 years ago.
3rd pass

Download all attachments as: .zip

Change History (12)

#1 @ankit.gade@…
6 years ago

  • Keywords has-patch added

#2 @johnbillion
6 years ago

  • Keywords needs-docs added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

Looks good. The new parameter needs adding to the filter docblock though.

@ankit.gade@…
6 years ago

The new parameter added in docblock

#3 @ankit.gade@…
6 years ago

Hi John,

New diff file has been added, It contains new parameter in docblock as per your suggestion.

#4 @ankit.gade@…
6 years ago

  • Keywords needs-docs removed

#5 @kpdesign
6 years ago

30440.3.diff contains parameter formatting fixes, and adds the changelog entry.

@kpdesign
6 years ago

3rd pass

#6 @DrewAPicture
6 years ago

  • Keywords commit added

30440.3.diff looks good for commit in 4.2.

This ticket was mentioned in Slack in #core by wpgeeko. View the logs.


6 years ago

#8 @DrewAPicture
6 years ago

  • Milestone changed from Future Release to 4.2

#9 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 31000:

Pass the $adjacent parameter to the "{$adjacent}_post_link" filter.

props ankit.gade@…, kpdesign.
fixes #30440.

Note: See TracTickets for help on using tickets.