[Resolved] GenerateBlocks won’t update background-image url after domain change

Home Forums Support [Resolved] GenerateBlocks won’t update background-image url after domain change

Home Forums Support GenerateBlocks won’t update background-image url after domain change

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #1533637
    Dominik

    Hi,

    the URLs from images, embedded as background-images in a GenerateBlocks container, won’t update after a domain change. I encountered this problem twice with two different sites running on GeneratePress & GenerateBlocks. It occurs when I am transferring a website or just change the domain.

    I also changed all database entries with plugins like “Better Search Replace”. All other pictures and the rest of the site worked fine. Only the background images are stuck to the old URL.
    A workaround is to open the page editor for each page and press the update button. This works for small sites but with larger ones it might be a lot of work.

    Is there a fix for this?

    thx
    Manuel

    #1533847
    Elvin
    Staff
    Customer Support

    Hi Manuel,

    Can you specify which tables did you do a better search replace?

    GB’s code will appear like this on posts’ contents within the database under wp_posts table.

    <!-- wp:generateblocks/container {"uniqueId":"8efe5669","bgImage":{"id":169,"image":{"url":"http://elvin.wppluginsupport.net/wp-content/uploads/2020/11/d7c12733-5eb6-378a-96f0-40ea88e17650.jpg","height":746,"width":1120,"orientation":"landscape"}}} -->
    <div class="gb-container gb-container-8efe5669"><div class="gb-inside-container"></div></div>
    <!-- /wp:generateblocks/container -->

    Say for this example, we want to replace http://elvin.wppluginsupport.net with http://www.yoursite.net.

    We’ll have to do a better search and replace or these 2 strings on the wp_posts table.

    #1534207
    Dominik

    Hi Elvin,

    I have selected all tables available and tried replacing many different string variations.

    https://www.domain.com
    www.domain.com
    //www.domain.com
    /www.domain.com
    etc.

    The structure of the page is very simple.

    HTML

    <div class="gb-container gb-container-d635c43a">
    <div class="gb-inside-container"></div>
    </div>

    CSS

    gb-container.gb-container-d635c43a {
        background-image: url(//www.domain.com/picture.jpg);
        background-repeat: no-repeat;
        background-position: center center;
        background-size: cover;
    }
    #1535026
    Tom
    Lead Developer
    Lead Developer

    That’s strange – these are just simple strings in your content. Plugins should be able to replace them quite easily.

    Any chance you can link us to one of the pages?

    #1535625
    Dominik

    Sure, find the link in the private section. We already manually updated the URLs with hitting the update button on each page again. On this subpage the hero image was the problem. All other pictures worked fine from the beginning.

    #1536481
    Tom
    Lead Developer
    Lead Developer

    Ah, I see the issue.

    The CSS for each page is built as a static CSS file so it can be cached.

    Changing the URLs worked, but the CSS was still cached using the old URLs.

    When this happens, simply go to “Settings > GenerateBlocks” and hit the Regenerate CSS Files button – this will automatically rebuild the CSS files for you so you don’t have to manually re-save each page.

    #1537187
    Dominik

    Thanks for the hint and your help :). For me it looks a lot like that’s the solution and I will try it next time.

    #1537908
    Tom
    Lead Developer
    Lead Developer

    No problem! 🙂

    #1678396
    Ingo

    I run into the same (and I am looking for an automated solution)..

    Is it also a ‘clean solution’ to ‘search-and-replace’ the URLs directly into the static CSS-Files? Say on the commandline with:

    sed ‘s/old-domain/new-domain/g’ /wp-content/uploads/generateblocks/*.css

    after a:

    wp search-replace ‘old-domain’ ‘new-domain’ –report-changed-only

    Or does generatepress itself support wp-cli?
    Thank you for any comments on my topic,

    Ingo Baab

    #1678981
    Elvin
    Staff
    Customer Support

    Hi there,

    If I may suggest:

    Better Search Replace plugin is usually enough for things like this: https://wordpress.org/plugins/better-search-replace/

    About wp-cli:

    WP-CLI isn’t theme dependent so you don’t have to worry about what theme you’re using.

    #1700035
    HO YAN

    I have replaced the image url but the image didn’t change.

    #1700044
    Ingo

    Caching?

    wp cache flush

    #1700062
    HO YAN

    I have cleared cache but nothing changes

    #1700242
    David
    Staff
    Customer Support

    Hi there,

    can you raise a new topic where you can share a link to your site and we can take a look.

    #2202788
    bjbowen

    Is there a way to avoid having to do this?

    I’ve pulled my hair out trying to find out why I couldn’t get my images to show up after I moved from production to the live site.

    Search replace with a plugin
    Search/replace in the database

    Cloning the site to another subdomain and then back to the live site… ONly to find that I have to go to GenerateBlocks and regenerate the CSS??

    Whewwwwwww…. How can I avoid that because wow.

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.