Opened 15 years ago
Closed 15 years ago
#10916 closed enhancement (wontfix)
Add filter hooks to page_menu/list_pages hyperlinks
Reported by: | Sam_a | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8.4 |
Component: | General | Keywords: | has-patch tested |
Focuses: | Cc: |
Description
Patch adds 2 new filter hooks, page_anchor_contents
, and page_anchor_attributes
, to let plugin/theme authors filter the hyperlinks printed by wp_page_menu()
and wp_list_pages()
-- substituting a menu label different from the Page's title, changing the title attribute, or adding new attributes, for example.
It's possible to do this now by reading the whole output from the wp_list_pages filter
, using regexp to find the Page you want, retrieving the post data, and then doing a regexp replace, but we can make it a lot simpler.
The new hooks follow the existing page_css_class
filter hook and pass the current $page object to the filter function, so per-page filtering is super easy.
Tested successfully in 2.8.4 and trunk.
Adds 'page_anchor_contents' and 'page_anchor_attributes' filter hooks to Walker_Page class