[wp-trac] [WordPress Trac] #49740: Hooking to page_attributes_dropdown_pages_args filter adds a dropdown to the Page Attributes metabox

WordPress Trac noreply at wordpress.org
Tue Mar 31 14:08:45 UTC 2020


#49740: Hooking to page_attributes_dropdown_pages_args filter adds a dropdown to
the Page Attributes metabox
-------------------------------------------+----------------------
 Reporter:  nfmohit                        |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  closed
 Priority:  normal                         |   Milestone:
Component:  Editor                         |     Version:  5.4
 Severity:  normal                         |  Resolution:  invalid
 Keywords:  has-screenshots needs-testing  |     Focuses:
-------------------------------------------+----------------------
Changes (by johnbillion):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 @nfmohit This is more of a support question which you'll need to post on
 wordpress.org/support, but the problem seems to be that a) you're using
 `add_action` instead of `add_filter`, and b) you're missing a return
 statement in your callback(s). This  combined causes the default arguments
 to be passed to `wp_dropdown_pages()` which causes it to be unexpectedly
 output instead of assigned to a variable and used later.

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


More information about the wp-trac mailing list