[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 11:38:23 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:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  5.4
 Severity:  normal        |   Keywords:  has-screenshots needs-testing
  Focuses:                |
--------------------------+-------------------------------------------
 Hi team!
 I hope you're all doing well in these challenging times.

 WordPress: 5.4-RC2-47447
 Classic Editor: 1.5

 ''This only happens with the classic editor''. I'm seeing an unusual
 behaviour with `page_attributes_dropdown_pages_args` hook. Basically, I'm
 using it to limit the depth of a hierarchical post type's to 1 using the
 following code:

 {{{#!php
 <?php
 function set_bp_custom_menu_depth( $a ) {
         global $post;
         if( $post->post_type == 'bp_custom_menu_page' ) {
                 $a['depth'] = 1;
                 return $a;
         }
 }
 add_action( 'page_attributes_dropdown_pages_args',
 'set_bp_custom_menu_depth' );
 }}}

 But whenever I use that hook, it adds a dropdown to the "**Page
 Attributes**" metabox in the page edit screens. [https://take.ms/1WQDU
 Here's a screencast for reference]. It also removes the "(no parent)"
 option from the "Parent" dropdown. [https://take.ms/2AfIU Here's a
 screencast for reference].

 This also happens even if you just hook an empty function to it, for
 example:

 {{{#!php
 <?php
 add_filter( 'page_attributes_dropdown_pages_args', function() {} );
 }}}

 I want to confirm if this is expected behaviour or a bug. Please advise.

 Kind regards,
 Nahid

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


More information about the wp-trac mailing list