Skip to main content
code highlighting
Source Link
Nicolai Grossherr
  • 18.9k
  • 8
  • 64
  • 109

Stefano answer is great but it lacks a distinct clause :


function segnalazioni_search_distinct( $where ){
    global $pagenow, $wpdb;

    if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='segnalazioni' && $_GET['s'] != '') {
    return "DISTINCT";
       
    }
    return $where;
}
add_filter( 'posts_distinct', 'segnalazioni_search_distinct' );
function segnalazioni_search_distinct( $where ){
    global $pagenow, $wpdb;

    if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='segnalazioni' && $_GET['s'] != '') {
    return "DISTINCT";
       
    }
    return $where;
}
add_filter( 'posts_distinct', 'segnalazioni_search_distinct' );

Add the code above update it and it will work with no duplicates.

Stefano answer is great but it lacks a distinct clause :


function segnalazioni_search_distinct( $where ){
    global $pagenow, $wpdb;

    if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='segnalazioni' && $_GET['s'] != '') {
    return "DISTINCT";
       
    }
    return $where;
}
add_filter( 'posts_distinct', 'segnalazioni_search_distinct' );

Add the code above update it and it will work with no duplicates.

Stefano answer is great but it lacks a distinct clause :

function segnalazioni_search_distinct( $where ){
    global $pagenow, $wpdb;

    if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='segnalazioni' && $_GET['s'] != '') {
    return "DISTINCT";
       
    }
    return $where;
}
add_filter( 'posts_distinct', 'segnalazioni_search_distinct' );

Add the code above update it and it will work with no duplicates.

Source Link

Stefano answer is great but it lacks a distinct clause :

function segnalazioni_search_distinct( $where ){
    global $pagenow, $wpdb;

    if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='segnalazioni' && $_GET['s'] != '') {
    return "DISTINCT";
       
    }
    return $where;
}
add_filter( 'posts_distinct', 'segnalazioni_search_distinct' );

Add the code above update it and it will work with no duplicates.