Just wanted to post a fix that I found yesterday when moving a development site to live. It wasn’t obvious at all and thought that with the same issue may find it useful.
The dev site was basically at a url similar to domain.com/dev-site/ and the mp3 player was working great. The site was for a musician so there were lots of tracks and playlists. The designer loved it too as it was so easy to tweak the layout. But as soon as I wanted to make it live i.e. move it from domain.com/dev-site/ to domain.com even though the layouts worked fine the tracks would not play.
I searched through this forum for a good 3 hours trying all the suggestions but found nothing that worked. In the end I turned off the file path obfuscation in the settings so I could see what was being loaded in the source. The file path still included /dev-site/ as part of the path. Which meant that the plugin was getting the path from a file rather than building it on the fly. I thought it might be cookie or local storage but couldn’t find anything there. I looked through the plugin files and found it here: (in main.php)
$audio = $wpdb->get_results("SELECT DISTINCT guid, post_title, post_excerpt, post_content, ID FROM $wpdb->posts WHERE post_mime_type = 'audio/mpeg'" . $order);
That was the ‘aha’ moment. Pretty obvious once you see it but wouldn’t have guessed it. If you don’t understand it, it’s a database query. The file path is the guid field. I logged into PHPMyAdmin and updated the posts table.
Voila! Now everything works.
What’s going on? When you upload a file into the media library the file path is stored in the database. The mp3 player is using this path. But this path doesn’t get updated when you move site. You could argue that there are different ways to move the site such as leaving the wordpress core files inside /dev-site/ or that I should have just purged the database with a basic find / replace because. I moved everything from /dev-site/ into root.
Hope this helps someone out.
- The topic ‘Problem and fix for player when moving website’ is closed to new replies.