1

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?

  • i have tried looking for the hook or action that adds the form, without this i cant do anything – danyo Jul 17 '13 at 9:59
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.

  • thanks for the answer, this is what i am trying to achieve, i want to replace the functionality of it, by adding javascript to it. But didnt know how to hook into it – danyo Jul 17 '13 at 15:22
  • 1
    Then you have a pure Javascript question, which is off topic per the faq. The word "hook" tends to imply a WordPress "hook"-- an action or a filter. There are none that you can use. Try asking at Stack Overflow. – s_ha_dum Jul 17 '13 at 15:25
  • 2
    Carelessly written JS might be able to hijack it as well. :) +1 – Johannes Pille Jul 17 '13 at 15:37
0

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

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.