Move WP file sync to separate if statement, search for media files by directory rather than by DB