[wp-trac] [WordPress Trac] #44727: WP 4.98 creates fatal on filet list_pages

WordPress Trac noreply at wordpress.org
Sat Aug 4 11:51:19 UTC 2018


#44727: WP 4.98 creates fatal on filet list_pages
--------------------------+----------------------
 Reporter:  BackuPs       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Menus         |     Version:  4.9.8
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by swissspidy):

 * keywords:  needs-patch =>
 * resolution:   => invalid
 * status:  new => closed
 * component:  General => Menus
 * milestone:  Awaiting Review =>


Comment:

 In `\Walker_PageDropdown::start_el()`, WordPress uses the `list_pages`
 filter as follows:

 {{{#!php
 /**
  * Filters the page title when creating an HTML drop-down list of pages.
  *
  * @since 3.1.0
  *
  * @param string $title Page title.
  * @param object $page  Page data object.
  */
 $title = apply_filters( 'list_pages', $title, $page );
 }}}

 In your code you are only passing the post title, but not the post object.
 That's why there's a fatal error:

 Any function hooked to the `list_pages` filter (in this case
 `_wp_privacy_settings_filter_draft_page_titles`) expects two variables,
 but you're only passing one.

 You should use `apply_filters( 'list_pages', $page->post_title, $page );`
 instead.

 Since this is not a bug in core but really a support question, I kindly
 refer you to open a thread on https://wordpress.org/support for future
 questions in that regard.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44727#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list