Disable inline_edit() on edit.php

In the class WP_Posts_List_Table there is a function named inline_edit() and it is responsible for rendering the entire quick edit table that is used (but initially hidden) on wp-admin/edit.php.

I want to prevent that table from being rendered because the site I’m working on has thousands of category terms and they all get added to this quick edit table as list items with checkboxes. It makes edit.php huge and slow loading (and in certain cases with some jQuery plugins even make some browsers stall).

Read More

I have not found any way, with filters or actions in WP_Posts_List_Table, to prevent this table from being rendered. Nor no way to make edit.php not call $wp_list_table->inline_edit(); at the end. Is there some (proper) way to achieve my goal? Without hacking core, of course.

(I do know how to disable the quick edit link in the post rows with post_row_actions filter but that huge table is still being rendered and sent with edit.php.)

Related posts

2 comments

  1. I was never able to find a filter either, but there is a check for whether the taxonomy is allowed to show it’s UI. So what I used to do in one of my plugins was to tweak the $wp_taxonomies global variable on the edit page.

    /**
     * Disable the UI for categories, but only on EDIT screen
     * which prevents them from appearing in quick edit
     */
    add_action( 'load-edit.php', 'wpa_130501_disable_ui' );
    
    function wpa_130501_disable_ui(){
        global $wp_taxonomies;
        $wp_taxonomies['category']->show_ui = FALSE;
    }
    

    The quick-edit section needs a lot of love in a future update.

  2. Had the same issue a while, i solved it by changing the term_list with a filter tho remove all checkboxes when i’m on the edit.php page. First, you can remove the link with this:

        function remove_quick_edit( $actions ) {
            unset($actions['inline hide-if-no-js']);
            return $actions;
        }
        add_filter('post_row_actions','remove_quick_edit',10,1);
    

    This will only remove the link, but the actual category selector is still in the source code…

        add_filter('wp_terms_checklist_args', 'remove_terms_from_list', '', 2);
        function remove_terms_from_list( $args, $post_id){
            global $pagenow, $typenow;
            if ($pagenow == 'edit.php' && $typenow == 'post-type-name' || $pagenow == 'nav-menus.php') {
                $args['walker'] = new wiki_remove_tax_quickedit;
                $args['taxonomy'] = ' ';
            }
            return $args;
        }
    
        class wiki_remove_tax_quickedit extends Walker {
            var $tree_type = 'category';
            var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
    
            function start_lvl( &$output, $depth = 0, $args = array() ) {
                    $indent = str_repeat("t", $depth);
                    $output .= "$indent<ul class='children'>n";
            }
    
            function end_lvl( &$output, $depth = 0, $args = array() ) {
                    $indent = str_repeat("t", $depth);
                    $output .= "$indent</ul>n";
            }
    
            function start_el( &$output, $category, $depth, $args, $id = 0 ) {
    
            }
        }
    

    (change the post-type-name to your post type) 

Comments are closed.