Automattic / Automattic/jetpack

Sync: Add 3rd-party support for siteurl on Bedrock framework

Open
#8,213 5 comments 0 reactions 0 assignees View on GitHub
[Focus] Compatibility [Package] Sync [Pri] Low [Status] Auto-allocated [Status] Stale Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

In #7997, @jeherve reported an issue where the siteurl value was not correctly syncing for a multisite.

The following is mostly copied over from that issue so we can track it separately.

After digging in, it appears as if Bedrock doesn't handle the `home` and `siteurl` options the same as core, and perhaps, out of the box, has errors with multisite.

For example:

- https://github.com/roots/bedrock/issues/58
- https://github.com/roots/bedrock/pull/251

Multisite in core removes the default `option_home` and `option_siteurl` filters in favor of the values stored in the db. From what I can tell, Bedrock recommends setting both values to the main URL, even though WordPress is stored in a subdirectory. Then there's a Bedrock plug-in that they use to overwrite the URLs:

https://github.com/roots/bedrock/pull/276

We were able to work with the user affected and confirmed that the following works. So, now we just need to find a way to detect the Bedrock framework so that we can tie this in.

```
add_filter( 'jetpack_sync_site_url', 'jetpack_fix_url_for_bedrock' );

function jetpack_fix_url_for_bedrock( $value ) {
if ('/wp' !== substr($value, -3)) {
$value .= '/wp';
}
return $value;
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading issue #7997 and the linked Bedrock reports and pull requests to understand how Bedrock handles home and siteurl in multisite. Then locate Jetpack Sync's site URL handling and determine how Bedrock can be detected; done means the confirmed Bedrock URL behavior is supported without affecting core multisite behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.