• I have a site that has 300 posts that do not have an assigned thumbnail to them. I do not want to put a PHP statement for featured thumbnail on the front end, but be able to use 1 thumbnail image (like default-featured-thumbnail.jpg )

    Now, I know if I load it to the media library, WordPress will attach a number to it (meta_id)… so I also know that number will be the one I want to mass insert into posts that do not have an assigned thumbnail (meta key is _thumbnail_id in the wp_postmeta). However, I also see that I need to have post_id

    I am trying to wrap my head around a code to do this and thought I would pick anyone’s brain to be able to come up with a code that runs the query that will do this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Why do you not want to put a PHP statement as a default? Long term, that’s going to be a much better route and easier to manage.

    Think about if you ever want to change that default thumbnail…you’d have to delete it, reupload it, and reset every post again.

    Using a if ( !thumbnail ) { use this } is a LOT easier. It’s really not much of a toll on your server either, if you’re concerned about server resources. PHP is very fast when it comes to this.

    Thread Starter Nile Flores

    (@blondishnet)

    This is not for my site and the person it is for is a friend that will not be changing her thumbnails. I have already discussed this with her and that is what she asked about.

    I told her the same thing you did.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Mass insert thumbnail to posts via MySQL’ is closed to new replies.