1

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).

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.)

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.

  • Or maybe we can turn the taxonomy NOT hierarchical the same way, so the quick edit panel keeps working and the category selector is a search based solution, like the tags – passatgt Jan 21 '14 at 15:30
  • That was an improvement. At first it didn't work for me until I realized that I had to replace category with the name of the taxonomies used on the site, and call ->show_ui = FALSE for each of them. This works and removes them for quick edit and my edit.php loads fast again. And quick edit remains useful for dates and titles etc. – Adrian B Jan 21 '14 at 20:10
  • About setting them to non-hierarchical: This can be done with $wp_taxonomies['category']->hierarchical = FALSE; and you get text fields with auto completion instead. BUT! They do not save correctly, I tried and lost all terms when using this on quick edit. Otherwise that would have been a good solution. – Adrian B Jan 21 '14 at 20:12
0

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) 

  • Ok, I haven't used the Waker class before, but I'll look into it. So this will remove all the list items, but otherwise leave the rest of the quick edit, right? (And yes, as I said in the original question, I do know about using post_row_actions and what it does and does not do.) – Adrian B Jan 21 '14 at 8:13
  • Yes, the first part of the code(post_row_actions) will remove the Quick edit link, but the actual quick edit div is still hidden in the source code. With the walker class, i simply removed all of the options from the taxonomy terms selector list, so it won't impact your page rendering. So at the end, the quick edit div is still there, but its not "really" there:) – passatgt Jan 21 '14 at 9:51
  • I corrected some minor syntax error in the code and then it worked. Your solution does remove all category terms and edit.php once again loads fast. While not a complete removal of all the quick edit parts nor a way to disable the call for inline_edit() this is the best workaround so far. – Adrian B Jan 21 '14 at 14:23
  • I thought that maybe I could leave the quick edit link visible (yes, I still know what post_row_actions does) since my editors like to use quick edit to change dates on posts. But a warning to anyone who tries this: when the quick edit changes are saved then all terms are removed from the post because none is selected (since they are not there to be selected any more). It would actually be nice if the quick edit could be used without messing up the categories, but as of now don't use it with this walker code. – Adrian B Jan 21 '14 at 14:23
  • One should also remove quick edit from the bulk action menu since it triggers the quick edit funktion. – Adrian B Jan 21 '14 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.