Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to create new topic or reply to the topic.

  • Author
    Posts
  • in reply to: Add Database ID search as a result ? #5876
    chris ortega
    Participant
    • Topics: 1
    • Replies: 2

    I look forward to it.
    I’ll see if I can get it working, appreciate the options given.

    Have a good one.

    in reply to: Add Database ID search as a result ? #5872
    chris ortega
    Participant
    • Topics: 1
    • Replies: 2

    Thought this would work since it looks like you are just stringing together terms using $wpdb->prepare to create a query.
    Any hints on why it’s not working ? it just returns no results. I’m sure if I spend enough time I’ll figure it out but you can probably point me in the right direction and cut my time by a lot. I look forward to this implementation in the future! Also happy to buy support if that includes helping me get this working til the official release.

    Appreciate your time!

    
            foreach ( (array) $q['search_terms'] as $term2 ) {
                $term = $f . $wpdb->esc_like( $term2 ) . $l;
                $OR = '';
                $search .= "{$searchand} (";
                
                if ( isset( $q['_is_includes']['search_title'] ) ) {
                    $search .= $wpdb->prepare( "({$wpdb->posts}.post_title {$like} '%s')", $term );
                    $OR = ' OR ';
                }
    // my code starts here
                if(true){
                    $cleanTerm = str_replace('%', '', $term);
                    if( 1 == is_numeric($cleanTerm)){
                        $search .= $wpdb->prepare( "(SELECT * FROM {$wpdb->posts} WHERE ID = %d)", $term );
                    }
                }
    
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to create new topic or reply to the topic.