TomodomoCo / total-slider

A WordPress plugin for creating, editing and removing ‘slides’ with text and images (for a homepage, for example).
GNU General Public License v2.0
7 stars 2 forks source link

Slides Not Visible after Domain Change #15

Closed dmuellerstl closed 12 years ago

dmuellerstl commented 12 years ago

Hi, I submitted this on WordPress support too, but thought I'd drop it in here as well in case it is monitored for support requests more frequently.

I recently used total slider on a site and then changed the domain name after completing the development phase. My usual process for this is to run a find/replace on the database after changing the domain name, in order to fix any broken links. But for some reason, the slides aren't displaying. If I change the domain back to the original, the slides start working again. Any suggestions? Thanks! -Dave

PeterUpfold commented 12 years ago

I've begun to answer the 'support' angle to this query on the WordPress support forums.

This thread is intended for the technical issue itself, and proposed solutions:

Background image URLs for slides are stored as literal strings which are the URL of the background image. Upon migrating a site across domains, many people will use find/replace on the database to update old URL references to the new domain.

However, using find/replace 'blindly' on serialised options is likely to break the serialisation, as the length of serialised strings will change, but the string length prefix will not change. (Explanation)

Total Slider already, I believe, has undocumented support for having an integer representing a post ID (attachment_ID?) instead of the literal URL.

While there is a performance overhead to having to look up the URL from the attachment ID each time on display, this might be an elegant way to solve this. It is more complicated, however, and diverges from how WordPress core does things (after all, that's why you have to find/replace post_content from the old URL to the new one!)

chrisvanpatten commented 12 years ago

In my humblest of opinions, the way WordPress core does it is flat out wrong; plain and simple. Hardcoding asset URLs—unless you are doing it willingly and intentionally—is essentially asking for things to break. I know they use that method in the post editor, but it's been a pet peeve of mine for (quite literally) years. It has introduced a number of problems, and I wish they would find a better way to handle it.

I fully support the extra overhead of looking looking up URLs from attachment IDs. It saves on support questions and it saves on user frustration.