您必须将或零件括在括号内:
$sql = "SELECT ID,post_title,post_content,post_date,post_type
FROM {$wpdb->posts}
WHERE (post_content LIKE {$stuff})
AND post_status = \'publish\'
AND post_type = \'{$post_type}\'
AND ID != {$post->ID}
LIMIT {$limit}";
$results= $wpdb->get_results($sql);
试试这个:
SELECT ID,post_title,post_content,post_date,post_type FROM wp_posts WHERE (post_content LIKE \'%Battery%\' OR post_content LIKE \'%Watcher%\' OR post_content LIKE \'%Widget%\' OR post_content LIKE \'%matches%\' OR post_content LIKE \'%built%\' OR post_content LIKE \'%HTC%\' OR post_content LIKE \'%widgets%\' OR post_content LIKE \'%Please%\' OR post_content LIKE \'%check%\' OR post_content LIKE \'%Thrutu%\' OR post_content LIKE \'%day%\' OR post_content LIKE \'%job%\' OR post_content LIKE \'%app%\' OR post_content LIKE \'%donate%\' OR post_content LIKE \'%buying%\') AND post_status = \'publish\' AND post_type = \'articles\' AND ID != 1388 LIMIT 4