Remove specific items from Quick Edit menu of a Custom Post Type?

There’s no hooks to modify the Quick Edit, it has to be done with CSS and/or jQuery.

The plugin Adminimize is very good to hide administrative elements, CPTs included.

But in the Quick Edit box, for lack of CSS classes or ID’s to target, it is not possible to hide the slug field, and only possible to partially hide the date adding a custom option as in the following snapshot.

adminimize cpt
click to enlarge


So, a pure jQuery solution is necessary:

add_action( 'admin_head-edit.php', 'wpse_59871_script_enqueuer' );

function wpse_59871_script_enqueuer() 
{    
    /**
       /wp-admin/edit.php?post_type=post
       /wp-admin/edit.php?post_type=page
       /wp-admin/edit.php?post_type=cpt  == gallery in this example
     */

    global $current_screen;
    if( 'edit-gallery' != $current_screen->id )
        return;
    ?>
    <script type="text/javascript">         
        jQuery(document).ready( function($) {
            $('span:contains("Slug")').each(function (i) {
                $(this).parent().remove();
            });
            $('span:contains("Password")').each(function (i) {
                $(this).parent().parent().remove();
            });
            $('span:contains("Date")').each(function (i) {
                $(this).parent().remove();
            });
            $('.inline-edit-date').each(function (i) {
                $(this).remove();
            });
        });    
    </script>
    <?php
}

Related quick-edit Q&A’s that I’ve worked

Leave a Comment