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

Ensure compatibility with Google Site Kit #4

Open
adamsilverstein opened this issue Jan 5, 2021 · 3 comments
Open

Ensure compatibility with Google Site Kit #4

adamsilverstein opened this issue Jan 5, 2021 · 3 comments

Comments

@adamsilverstein
Copy link

Hi! Adam here from the Google Site Kit team (https://sitekit.withgoogle.com).

We recently had some users reporting issues when they were using translatepress and Site Kit at the same time. (WordPress support forum and also here).

The underlying issue is that Site Kit identifies site's by their URL, as returned by WordPress's home_url function. When we detect that a site's URL has changed, we prompt (/force) the user to reconnect their site (going thru the auth process again). We do this to help users when they change their site URL for any reason (because otherwise, their connection is broken).

As a consequence, when plugins filter the home_url this logic can cause issues as the user gets unexpectedly disconnected. translatepress does this in add_language_to_home_url.

To improve compatibility in these types of situations, in Site Kit we added a googlesitekit_canonical_home_url filter (in google/site-kit-wp#2131). Site Kit uses the URL returned from this filter as our canonical URL, and as long as this URL doesn't change users will remain connected.

Using this filter, translatepress could add compatibility with Site Kit by returning the root site url of the site.

Pseudo code:

add_filter(
	'googlesitekit_canonical_home_url',
	function( $url ) {
		return $url_converter->get_abs_home(); // return root url.
	}
);

I would be happy to open a PR with this change. Is this something you would consider adding to your plugin?

@adamsilverstein adamsilverstein changed the title Ensure Compatibility with Google Site Kit Ensure compatibility with Google Site Kit Jan 5, 2021
@adamsilverstein
Copy link
Author

@sareiodata Is there a better venue to submit this type of request?

@razvan-translatepress
Copy link

Hi,

The latest TranslatePress version contains a compatibility fix that solves this issue. Google Site Kit’s dashboard no longer disconnects.

Thank you for your debugging effort!

P.S. This repository is not the official TranslatePress repo. We are not associated with the user who created this repo.

@mxbclang
Copy link

mxbclang commented Apr 5, 2021

Thank you for the update, @razvan-translatepress! We'll let our users know that this fix has been added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants