You may need to restructure the request as follows:
SELECT * FROM ( SELECT WP.*, SUM(LP.value) AS `value` FROM wp_posts WP LEFT JOIN (SELECT post_id FROM wp_wti_like_post WHERE post_status = 'publish') LP ON WP.ID = LP.post_id GROUP BY WP.ID ) T1 WHERE T1.value IS NULL OR T1.value < 2;
The Inner-most query first retrieves only published wti_like_posts.
Then a left join is performed, which will give you the expected result of extracting all the rows from wp_posts, even if they are not joining the record from the subquery.
After that, the GROUP statement calculates the SUMming values.
In the outermost request, the requirement is applied that the sum be either less than 2 or be zero.
source share