Make WordPress Core

Opened 3 years ago

Last modified 3 days ago

#22957 new defect (bug)

get_boundary_post Only works from a single page

Reported by: pathawks Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.8
Component: Posts, Post Types Keywords: has-patch needs-testing
Focuses: template Cc:


I was trying to use get_boundary_post in my theme to display a link to the first and last posts, but it does not work from the homepage. Unless called from a single post, get_boundary_post will return NULL.

I can't see any reason for this behavior, or any good way around it.

Attachments (2)

22957.diff (1.1 KB) - added by pathawks 3 years ago.
get_boundary_post from any page
get_boundary_post.diff (1.1 KB) - added by pathawks 5 weeks ago.

Download all attachments as: .zip

Change History (9)

comment:1 @SergeyBiryukov3 years ago

  • Component changed from General to Template

comment:2 @SergeyBiryukov3 years ago

Has been this way since introduction in [10815] (#8703).

comment:3 @pathawks3 years ago

What is the reason for this?

I understand why start_post_rel_link might want to only fire on single posts, but I see no reason to limit the avaliability of get_boundary_post.

On a related note, when there is nothing to return, why does it return NULL rather than FALSE like similar functions?

Last edited 3 years ago by pathawks (previous) (diff)

@pathawks3 years ago

get_boundary_post from any page

comment:4 @pathawks3 years ago

  • Keywords has-patch added
  • Version set to trunk

comment:5 @SergeyBiryukov3 years ago

  • Version changed from trunk to 2.8

comment:6 @nacin20 months ago

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

@pathawks5 weeks ago

comment:7 @chriscct73 days ago

  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.