PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 8, 2022

[FIXED] How to remove posts without images mysql query?

 July 08, 2022     image, mysql, posts, sql-delete, wordpress     No comments   

Issue

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?


Solution

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=%'


Answered By - Tin Tran
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing