-
Notifications
You must be signed in to change notification settings - Fork 20
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
Use the full domain name #214
Conversation
Use the full domain name instead of attempting to extract the top level TLD
Thanks @namithj! I'll review this one and run some tests for multisite. |
includes/class-utilities.php
Outdated
$domain_parts = explode( '.', $domain_name ); | ||
return sanitize_text_field( implode( '.', array_slice( $domain_parts, -2 ) ) ); | ||
public static function get_site_domain() { | ||
$site_url = get_site_url(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In multisite, plugins can only be installed on the network level. Therefore, the URL for the API should be the main site's URL.
With a multisite setup of:
- First site: https://my-site.com (main site)
- Second site: https://my-other-site.com
When on Second site, get_site_url()
will return https://my-other-site.com
.
Use network_site_url()
instead, as it will return https://my-site.com
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small change for multisite support. 🙂
network_site_url instead of get_site_url
I have pushed an update, technically it wouldn't matter as the settings page can only run from the main site of the network but no harm in having the proper function in place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @namithj!
Pre-approving, but do invite me for a re-review if you push the tests I sent you for this one just so the latest changes are also approved.
Signed-off-by: Colin Stewart <[email protected]>
Use the full domain name instead of attempting to extract the top level TLD
Pull Request
What changed?
Changed behavior of API Key call to use the full domain name instead of trying to extract the top TLD which can lead to parsing issues
Why did it change?
Extracting the top TLD was an unnecessary complication which is not required.
Did you fix any specific issues?
Fixes #194
CERTIFICATION
By opening this pull request, I do agree to abide by the Code of Conduct and be bound by the terms of the Contribution Guidelines in effect on the date and time of my contribution as proven by the revision information in GitHub.