質問

I run a few autoblogs on wordpress and sometimes the following problem occurs, while using FeedWordPress some syndicated posts don't contain images and I'd like to know if there is a query in mysql allowing removing posts without images?

役に立ちましたか?

解決

having no clue of what your structure or data looks like, here's something that might help.
before deleting, select to make sure that these are posts that you want to delete

SELECT * FROM posts WHERE post_content NOT LIKE '%<img src=%'

then after seeing the results and you're happy to delete them, use

DELETE FROM posts WHERE post_content NOT LIKE '%<img src=%'

他のヒント

Thanks for your hint, I modified it a little and received query with very satysfying results:

DELETE FROM wp_posts WHERE post_content NOT LIKE '%<img src=%'
AND ID not in (select post_id as p from wp_postmeta where meta_key like "_wp_attached_file")

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top