Remove order field from Page Attributes box

I'd like to remove, or at least hide, the Order field from the Page Attributes box. Anyone have a way to go about do this?

Topic wp-admin Wordpress

Category Web


If seeking to hide it in the WordPress block editor, the following CSS loaded into the admin works:

.editor-page-attributes__order {
    display: none;
}

I'm sure there's a more complicated JavaScript approach, but this meets my needs.


I like the answer above But if you wont that it work also with Gutenberg you must to add this selector: .components-base-control.editor-page-attributes__order

 add_action('admin_head', 'hide_order_attribution');
    function hide_order_attribution() {
             echo '<style>
                   label[for="menu_order"],
                   input[name="menu_order"],
                   .components-base-control.editor-page-attributes__order {
                     display:none;
                   }
                  </style>';
    }   

if you really just want to hide it from displaying or completely remove it. It’s a part of core Page Attribute Metabox which could'nt be remove permanently but this should help get you going in the right direction.

add_action('admin_head', 'hide_order_attribution');
function hide_order_attribution() {
         echo '<style>
               label[for="menu_order"],
               input[name="menu_order"] {
                 display:none;
               }
              </style>';
}   

I went with jQuery to remove the elements.

jQuery(document).ready(function() {
  jQuery('#pageparentdiv label[for=menu_order]').parents('p').eq(0).remove();
  jQuery('#pageparentdiv input#menu_order').remove();
});

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.