Custom SQL Query passing array to WHERE p.id

This is more of a SQL question then a WordPress question.

Here are some ideas:

  • You’re most likely looking for this kind of structure:

    AND p.ID NOT IN (1433, 1344)
    
  • You should consider using $wp->prepare() if your query depends on some user input.

  • You might also want to replace CURDATE() with a PHP generated date string, to see if it gives you any performance gain.

  • In general it’s more flexible to use the WP_Query() when possible, to avoid such hardcoded SQL bastards 😉