remove post edit.php search form and replace with my own

I am desperately looking for some way to hook into the post search option on edit.php. I would like to remove this feature and replace it with my own live search options. Does anyone have any help they can provide here?

Related posts

2 comments

  1. The search form is here. It is part of the WP_List_Table class and is not replaceable as far as I can tell.

    However, you are talking about a livesearch which is necessarily Javascript. Carefully written Javascript should be able to hijack that form. You should not need to replace it.

  2. You may not be able to replace the table that edit.php spits out, but you can add your own table and simply hide the default table made by WordPress.

    Here are a few hooks where you could determine which post_types you want to add your new search table:

    add_action( 'load-edit.php', 'd_test' );
    function d_test() {
    
        //print_r($_REQUEST);
    
        $post_type = $_REQUEST['post_type'];
    
    
        if( $post_type == 'your_custom_post_type' ):
            //this hook will attach your_new_table function right above the default content of edit.php
            add_action('all_admin_notices','your_new_table');
    
        endif;
    
    
    }
    
    function your_new_table(){
    
        echo '<style type="text/css">.wrap{display:none;}</style>';
        echo display_your_great_new_seach_table();
    }
    

    It feels a little hacky using the css to just hide the .wrap div, but at least it does not edit any WordPress core code. I wish that edit.php simply contained a filter hook to replace its main content.

    I hope this will be more useful than simply changing the table by Javacsript

Comments are closed.