Plugin Directory

Changeset 2383703


Ignore:
Timestamp:
09/17/2020 01:24:37 PM (6 years ago)
Author:
kodeks
Message:

ACF search check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kodeks-dashboard/trunk/functions.php

    r2273711 r2383703  
    710710 */
    711711
    712 if ( ! function_exists( 'kodeks_search_join' ) ) {
     712$search_plugin = false;
     713if(in_array('acf-better-search/acf-better-search.php', apply_filters('active_plugins', get_option('active_plugins')))){
     714    $search_plugin = true;
     715};
     716
     717if ( ! function_exists( 'kodeks_search_join' ) && $search_plugin == false ) {
    713718
    714719    function kodeks_search_join( $join ) {
     
    731736 */
    732737
    733 if ( ! function_exists( 'kodeks_search_where' ) ) {
     738if ( ! function_exists( 'kodeks_search_where' ) && $search_plugin == false ) {
    734739    function kodeks_search_where( $where ) {
    735740        global $pagenow, $wpdb;
     
    746751}
    747752
    748 /**
     753    /**
    749754 * Prevent duplicates
    750755 *
    751756 * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_distinct
    752757 */
    753 if ( ! function_exists( 'kodeks_search_distinct' ) ) {
    754     function kodeks_search_distinct( $where ) {
    755         global $wpdb;
    756 
    757         if ( is_search() ) {
    758             return "DISTINCT";
    759         }
    760 
    761         return $where;
    762     }
    763     add_filter( 'posts_distinct', 'kodeks_search_distinct' );
    764 }
     758    if ( ! function_exists( 'kodeks_search_distinct' ) && $search_plugin == false ) {
     759        function kodeks_search_distinct( $where ) {
     760            global $wpdb;
     761
     762            if ( is_search() ) {
     763                return "DISTINCT";
     764            }
     765
     766            return $where;
     767        }
     768        add_filter( 'posts_distinct', 'kodeks_search_distinct' );
     769    }
    765770
    766771
Note: See TracChangeset for help on using the changeset viewer.