Skip to content

FaustWP - Content Replacement Bug #2096

@colinmurphy

Description

@colinmurphy

Description

Here’s what we’re seeing with our current settings:
Current Case:
WordPress Settings:

General:
WordPress Address (URL): http://localhost:10005/
Site Address (URL): http://localhost:10005/

Media:
Full URL path to files: http://localhost:3000/wp-content/uploads

Faust:
Front-end site URL: http://localhost:3000/

Results:
srcset="http://localhost:3000http://localhost:3000/wp-content/uploads/2025/03/test-300x200.png 300w,...."
src="http://localhost:3000/wp-content/uploads/2025/03/test.png"

Case II:
WordPress Settings:

General:
WordPress Address (URL): http://localhost:10005/
Site Address (URL): http://localhost:10005/

Media:
Full URL path to files: (Removed, using default)

Faust:
Front-end site URL: http://localhost:3000/

Results:
srcset="http://localhost:3000/wp-content/uploads/2025/03/test-300x200.png 300w,...."
src="http://localhost:10005/wp-content/uploads/2025/03/test.png"

Let me know if you need more details.

Steps to reproduce

Setup example site as described above

The srcset is adding 2 FE domains e.g.

srcset="http://localhost:3000/wp-content/uploads/2025/03/test-300x200.png 300w,...."
src="http://localhost:10005/wp-content/uploads/2025/03/test.png" 

For context -

Findings So Far:
The issue seems to stem from changes in image_source_srcset_replacement in Faust. Specifically, the function:

$relative_upload_url = faustwp_get_relative_upload_url( $wp_site_urls, wp_upload_dir()['baseurl'] );
Since $wp_site_urls and wp_upload_dir()['baseurl'] are different in our case, the function returns null, causing the condition:

strpos( $url, $relative_upload_url ) === 0
to evaluate incorrectly. This results in Faust incorrectly appending the frontend URL twice.

Additional context

No response

@faustwp/core Version

N/A

@faustwp/cli Version

N/A

FaustWP Plugin Version

1.8.0

WordPress Version

6.7

Additional environment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions