Opened 6 years ago
Closed 6 years ago
#4182 closed enhancement (fixed)
Add ability to return list for wp_list_categories..
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Template | Version: | 2.1.3 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
Simply:
The function outputs directly to the page it does not allow any function to use the output.
Impact:
Plugins and templates which used the deprecated list_cats can not use the replacement.
Fix:
Change:
echo apply_filters('list_cats', $output);
To:
$output = apply_filters('list_cats', $output);
if ( $echo ) echo $output;
return $output;
Attachments (1)
Change History (9)
comment:1
Otto42
— 6 years ago
- Component changed from Administration to Template
- Milestone changed from 2.1.4 to 2.2
- Priority changed from high to normal
- Severity changed from major to normal
- Summary changed from bug with wp_list_catories to Add ability to return list for wp_list_categories..
- Type changed from defect to enhancement
- Version changed from 2.1.2 to 2.1.3
comment:5
Otto42
— 6 years ago
Regardless of what version it eventually goes in, here's a quick patch for it.
comment:7
foolswisdom
— 6 years ago
- Keywords has-patch added
Note: See
TracTickets for help on using
tickets.
This would make it similar to the functionality in wp_list_pages (and probably elsewhere too). Changes required are minimal.
At the end of wp_list_categories(), change the echo statement to this:
$output = apply_filters('list_cats', $output); if ( $r['echo'] ) echo $output; else return $output;Add this to the $defaults array:
And there you go. This will allow an "echo" parameter similar to wp_list_pages() echo parameter.