#44018 closed enhancement (fixed)
Adding a filter in paginate_links function
Reported by: | re.ardestani | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch commit has-dev-note |
Focuses: | template | Cc: |
Description
Possible to add a filter at the end of paginate_links function similar to this: http://take.ms/eBEyB
It's beneficial for developers to change anything from links, HTML, ... in the final output.
In my case, I want to change the HTML class so I can easily make it Bootstrap pagination friendly.
Attachments (2)
Change History (14)
This ticket was mentioned in Slack in #core by noisysocks. View the logs.
4 years ago
#3
@
4 years ago
I think the filter could have a better name than paginate_links_output
, though I haven't thought of one. I would have used paginate_links
if it weren't taken already.
#4
@
4 years ago
- Keywords commit added
I tested the patch, it still applies cleanly and I was able to filter the paginate links HTML output using the following test filter:
add_filter( 'paginate_links_output', function( $r ) { return 'test'; } );
Marking this for commit
.
#5
@
4 years ago
- Keywords needs-dev-note added
This will need a quick note in the Miscellaneous changes dev note.
#6
@
4 years ago
I think the filter should also receive the $args
array as a second parameter, for more flexibility. I can add that on commit.
#7
@
4 years ago
- Owner set to audrasjb
- Status changed from new to accepted
Hmm yes @SergeyBiryukov you're right. Adding a new patch right now.
adding proposed filter, with docblock