0

Right now I have this:

SELECT guid FROM wp_posts 
WHERE id NOT IN (SELECT post_id as p FROM wp_postmeta WHERE meta_key LIKE "_thumbnail_id") 
AND post_type = 'post'
AND post_date LIKE '%2016%'

I'm trying to get the permalinks of posts that do not have a feature image within x to y years. Is it possible to do something like:

AND post_date (get it from 2016-2017)
  • FYI, guid is not the same as the permalink and can't reliably be used as such. You need to load the WP environment and use the API to get a post's permalink. – Milo Jan 19 '17 at 4:55
0

Try this for posts from last 1 year:

AND ( 
  post_date_gmt < DATE(NOW()-INTERVAL 1 YEAR)
  ) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.