Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain is not changed for added fonts #196

Open
2 tasks done
srueegger opened this issue May 24, 2024 · 5 comments
Open
2 tasks done

Domain is not changed for added fonts #196

srueegger opened this issue May 24, 2024 · 5 comments

Comments

@srueegger
Copy link

Bug Report

Describe the current, buggy behavior

The command “wp search-replace” does not work as expected. With WordPress 6.5 the Gutenberg Full-Site-Editor got the possibility to add fonts (as direct upload or as direct download from Google Fonts).

If you now change the URL of a WordPress installation with “wp search-replace”, the URL of your own fonts is not adjusted - which means that the font files cannot be loaded.

Describe how other contributors can replicate this bug

  • install a WordPress Site on Domain A
  • Install any font from Google Fonts via the full-site editor in the standard design (twentytwentyfour) or upload any font.
  • Use this installed Font as Default
  • Copy the Site to Domain B
  • use "wp search-replace" to chnage the URL
  • open the Site on Domain B
  • In the browser source code you will then see that the domain of the fonts still refers to domain A

Describe what you would expect as the correct outcome

The domain of the fonts should also be changed via “wp search-replace”.

Let us know what environment you are running this on

OS:	Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64
Shell:	/bin/zsh
PHP binary:	/Applications/MAMP/bin/php/php8.1.13/bin/php
PHP version:	8.1.13
php.ini used:	/Applications/MAMP/bin/php/php8.1.13/conf/php.ini
MySQL binary:	/Applications/MAMP/Library/bin//mysql
MySQL version:	mysql  Ver 14.14 Distrib 5.7.39, for osx11.0 (x86_64) using  EditLine wrapper
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/Users/srueegger/Sites/compresso.ch
WP-CLI packages dir:	
WP-CLI cache dir:	/Users/srueegger/.wp-cli/cache
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.10.0
@swissspidy
Copy link
Member

What's the exact command that you are using? Have you tried the --precise flag?

@swissspidy
Copy link
Member

FWIW I cannot reproduce this.

I just did wp search-replace wordpress-cevelop wordpress-develop wp_post* on my local wordpress-develop.local site and the font URLs were replaced as expected in the source code.

@danielbachhuber
Copy link
Member

My guess is that the URLs are JSON encoded (related #186)

@srueegger
Copy link
Author

So the error is definitely reproducible for me. I have installed a standard Wordpress under the domain “domaina.dvl.to”. And uploaded the following fonts in the fullsite editor.

Then i set this font as the default for headings and texts.

Fonts:
testfonts.zip

This works fine:
Bildschirmfoto 2024-05-24 um 22 24 55

Then I simply copied the DocumentRoot and database and let the domain “domainb.dvl.to” point to it.

Then I use “wp search-replace” to change the domains, the process is also executed:

Bildschirmfoto 2024-05-24 um 22 29 51

When opening the domain, you can see that the fonts I have uploaded do not work. It is interesting to note that the fonts that are predefined in the WordPress theme “twentytwentyfour” seem to work perfectly.

Browser Console:

Bildschirmfoto 2024-05-24 um 22 30 58

Source Code with wrong Domain:

Bildschirmfoto 2024-05-24 um 22 31 26
@ernilambar
Copy link
Member

I can reproduce this issue and it is indeed related to encoded value. When fonts are uploaded, entry is created in posts table and post_content looks like this:

{"src":"http:\/\/foo.local\/wp-content\/uploads\/fonts\/SZc83FzrJKuqFbwMKk6EtUf57DtOmCc.woff2","fontWeight":"400","fontStyle":"normal","fontFamily":"\"Alex Brush\"","preview":"https:\/\/s.w.org\/images\/fonts\/17.7\/previews\/alex-brush\/alex-brush-400-normal.svg"}

When I try to generate sql after replacing the domain, eg:

wp search-replace 'http://foo.local' 'http://bar.local' --export=sample.sql

Then value shown above is not updated to new domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment