Opened 4 weeks ago
Last modified 12 days ago
#9286 new defect (bug)
bp_get_blog_latest_post not applying filters properly
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch reporter-feedback needs-testing |
Cc: | emaralive, pratiklondhe, rollybueno |
Description
The function
bp_get_blog_latest_post does this on line 763
apply_filters( 'the_title', $retval )
However if you look at the documentation of that filter:
https://developer.wordpress.org/reference/hooks/the_title/
You will see that the there are two parameters $post_title and $post_id and both are mandatory, so that any plugin that adds this filter and follows the documentation strictly will cause a fatal error
Can this be fixed asap please?
Change History (5)
This ticket was mentioned in PR #411 on buddypress/buddypress by @rollybueno.
12 days ago
#3
- Keywords has-patch added
Reported on https://buddypress.trac.wordpress.org/ticket/9286, the bp_get_blog_latest_post() will be using the_title filters but only provided 1 out of 2 required params
The patch includes creating new function called bp_get_blog_latest_post_id() which is just a copy of bp_get_blog_latest_post_title(), except it will return latest post ID instead of title.
Then we use this for the required param on the_title filters as per documentation: https://developer.wordpress.org/reference/hooks/the_title/
Ticket: https://buddypress.trac.wordpress.org/ticket/9286
Filter docs: https://developer.wordpress.org/reference/hooks/the_title/
Trac ticket: https://buddypress.trac.wordpress.org/ticket/9286