Skip to content

Removed dependency for WP default constant, by using new own constant… #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carstingaxion
Copy link

This PR removes the dependency for the WP default constant DOMAIN_CURRENT_SITE and introduce an new one called NSDU_URL, that everybody can use safely.

The most easy way would be to define( 'NSDU_URL', DOMAIN_CURRENT_SITE ); in the wp-config.php

This has 2 benefits:

  1. The default constant could be used different from default, what could cause Problems, while using it for the DB updates. In example if it was set dynamically like this:
if ( isset( $_SERVER['X_FORWARDED_HOST'] ) && !empty( $_SERVER['X_FORWARDED_HOST'] ) ) {
	$hostname = $_SERVER['X_FORWARDED_HOST'];
} else {
	$hostname = $_SERVER['HTTP_HOST'];
}
define( 'DOMAIN_CURRENT_SITE', rtrim($hostname, '/') );
  1. By not defining the new constant, e.g. on production sites, the Plugin would stop its work earlier and so be faster at all, while not doing its first DB hit.

btw

Thank you very much, for your nice work and also for publishing it.

Carsten

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

Successfully merging this pull request may close these issues.

1 participant