Custom Walker initialize error
|Reported by:||ShaneF||Owned by:||DrewAPicture|
|Component:||Posts, Post Types||Keywords:||good-first-bug has-patch|
While I was delvoping a customer walker for my wp_list_pages, I was having trouble getting it to read my customer extended class of Walker_Page. I was talking with DD32 last night and he came up with the solution..
wp_list_pages(array('walker' => 'new Walker_Page_Rabbit', 'title_li' => '', 'depth' => '1'));
wp_list_pages(array('walker' => 'Walker_Page_Rabbit', 'title_li' => '', 'depth' => '1'));
Clearly the reason for including the "new" was because in the 'category-template.php' and 'post-template.php' had...
if ( empty($r['walker']) ) $walker = new Walker_Page; else $walker = $r['walker'];
I found out that having 'new' in the
..caused a mismatched argument in the...
return call_user_func_array(array(&$walker, 'walk'), $args);
'new' would be passed on. Once I changed the code in the 'core' to include the new and I would define just 'Walker_Page_Rabbit' in the 'wp_list_page' and it worked perfectly.
if ( empty($r['walker']) ) $walker = new Walker_Page; else $walker = new $r['walker'];
This is a major blocker for any people who are working on customer walkers. Attached is a patch that does work.
Change History (26)
- Keywords ne added
- Resolution set to wontfix
- Status changed from new to closed
- Keywords needs-patch added; has-patch ne removed
- Resolution wontfix deleted
- Status changed from closed to reopened
- Keywords needs-phpdoc added
- Milestone changed from 2.9 to 3.0
- Priority changed from high to normal
- Severity changed from major to normal
- Type changed from defect (bug) to enhancement
comment:11 @ShaneF — 5 years ago
- Summary changed from Customer Walker initialize error to Custom Walker initialize error
comment:18 @DrewAPicture — 15 months ago
- Keywords good-first-bug added
- Type changed from enhancement to defect (bug)
comment:20 @DrewAPicture — 14 months ago
- Component changed from General to Posts, Post Types
- Keywords needs-patch added; has-patch removed
- Milestone changed from Future Release to 4.0