Title: Syndicate Software's Replies | WordPress.org

---

# Syndicate Software

  [  ](https://wordpress.org/support/users/syndicate-software/)

 *   [Profile](https://wordpress.org/support/users/syndicate-software/)
 *   [Topics Started](https://wordpress.org/support/users/syndicate-software/topics/)
 *   [Replies Created](https://wordpress.org/support/users/syndicate-software/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/syndicate-software/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/syndicate-software/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/syndicate-software/engagements/)
 *   [Favorites](https://wordpress.org/support/users/syndicate-software/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CSV Importer] [Plugin: CSV Importer] Featured Image](https://wordpress.org/support/topic/plugin-csv-importer-featured-image/)
 *  [Syndicate Software](https://wordpress.org/support/users/syndicate-software/)
 * (@syndicate-software)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-csv-importer-featured-image/#post-2411172)
 * I used Joy’s code from above, but it wasn’t working at first. I didn’t use the
   Import Legacy Media that she mentioned though – that might have been the problem.
   I used WP’s (ver 3.4.1) built in media uploader.
 * After a little inspection of the database, I found out what was going on – the
   WP uploader was adding the year & month directory names to the name of the image
   in the wp_postmeta table. (instead of the expected “image.jpg” it was “2012/8/
   image.jpg”)
 * Once I realized this, a quick change of the SQL query made it work perfectly.
   
   Change this:
 *     ```
       $imageID = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '$k' AND meta_value = '$v'");
       ```
   
 * to this:
 *     ```
       $imageID = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '$k' AND meta_value LIKE '%$v%'");
       ```
   
 * Don’t forget the double %’s around the $v. Now the query will search for any 
   value that CONTAINS your filename instead of EQUALS your filename.
 * Hope this helps!

Viewing 1 replies (of 1 total)