1

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)
1
  • 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, 2017 at 4:55

1 Answer 1

1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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