Opened 20 years ago
Closed 19 years ago
#2415 closed enhancement (fixed)
New hooks for previous and next post
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | 2.0.1 |
| Component: | Administration | Keywords: | hook previous next posts has-patch |
| Focuses: | Cc: |
Description
Getting the previous and next posts can be filtered by excluding categories, but it would be better to be able to filter more flexibly, like you can for get_posts(). The attached patch adds two new hooks prev_next_post_join and prev_next_post_where which are identical in purpose to the posts_where and posts_join filters.
The specific case I want to solve in filtering based on a custom query variable.
Attachments (3)
Change History (18)
#2
@
19 years ago
Please integrate this into the next version. There's a huge multilingual community who would like support for it.
#3
@
19 years ago
Yes please, I also would like to see this one integrated into WP core. The lack of these hooks turns to be one of the major headaches for us, the multilingual blog owners.
Even better; move this one to 2.0.5 milestone if it can be included in 2.0.5's own scope.
thanks...
#4
@
19 years ago
Personally, I would feel wary of adding new hooks to a bugfix release, which is primarily what 2.0.5's purpose is. I think plugins should be able to be written for the 2.0 or 2.1 branch, rather than for a specific revision, such as 2.0.4 or 2.0.5.
I don't think it would be great to have a plugin that worked on 2.0.5 and not 2.0.4, unless the reason the plugin broke on 2.0.4 was because of a bug in the core.
#5
follow-up:
↓ 6
@
19 years ago
- Milestone changed from 2.1 to 2.0.5
You can write plugins in a way that handles all cases. If you write a plugin that registers a non-existant filter, nothing goes wrong. It just starts to work 'better' when the filter becomes available.
Adding a filter isn't dangerous at all. You could safely assume in 99% of cases (except here, where I raised the ticket myself) that nobody's using that filter - why would they when it doesn't exist? At the very worst, it is temporarily redundant, until plugins are written to take advantage of it. And here, not even this is the case.
Gengo, the plugin for which I found a need for this filter, has had code in place to take advantage of this hook for 8 months now. It still works without it, but the posts aren't filtered correctly. As soon as this is in the core, Gengo will filter the posts better, with no modifications.
I'd really like this in 2.0.5 too. Feel free to put it back to 2.1 if there's a compelling reason.
#6
in reply to:
↑ 5
@
19 years ago
- Milestone changed from 2.0.5 to 2.1
Replying to majelbstoat:
You can write plugins in a way that handles all cases. If you write a plugin that registers a non-existant filter, nothing goes wrong. It just starts to work 'better' when the filter becomes available.
Agreed
Adding a filter isn't dangerous at all. You could safely assume in 99% of cases (except here, where I raised the ticket myself) that nobody's using that filter - why would they when it doesn't exist? At the very worst, it is temporarily redundant, until plugins are written to take advantage of it. And here, not even this is the case.
Agreed
I'd really like this in 2.0.5 too. Feel free to put it back to 2.1 if there's a compelling reason.
2.0.5 is a bug fix release - we should not be adding new features.
2.1 is not that far away therefore my vote for this is leave it for 2.1
#8
@
19 years ago
Can I ask why such a minor but useful modification will not be present in the next major release?
#10
@
19 years ago
- Milestone changed from 2.2 to 2.1
Setting the milestone to 2.1 given the low-impact and available patch. This unblocks many plugins who restrict posts.
Adds hooks to get_previous_post and get_next_post.