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

Add site and url WordPress constants #116

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

Conversation

jacobarriola
Copy link
Contributor

It would be easier to have these constants set, as most of the sites that spin up are existing, which have set urls in the options table. I don't know whether PH has a variable for the local url, but {{site_name}} is a start. The TLD (.dev) is probably problematic as well as the set protocol I have (http). Happy to get more information or open up a dialogue.

It would be easier to have these constants set, as most of the sites that spin up are existing, which have set urls in the `options` table. I don't know whether PH has a variable for the local url, but `{{site_name}}` is a start. The TLD (`.dev`) is probably problematic as well as the set protocol I have (`http`). Happy to get more information or open up a dialogue.
@philipnewcomer
Copy link
Member

@jacobarriola I generally do a DB search/replace of the live URL to the local URL whenever I import a production database, but I can see how this change would be helpful in not requiring that step.

Currently, in config/wp-config.php.inc there is only one template variable available, site_name. However, you can add more template variables in the createSite() function located in utils/sites.js. This line generates the content to add to wp-config.php:

wpConfigAdditionsContent = helpers.populateTemplate(wpConfigAdditionsContent, {site_name: environment.currentSiteName});

The object containing site_name contains the variables that will be available in the template, and I'd recommend creating a new variable site_url. I believe the full domain (including TLD) that the user specifies when creating the site can be found in siteConfig.domain. So you'd just need to add a protocol to that in order to have the full site URL that you can use in the wp-config constant.

So that just leaves us to decide whether to default to HTTP or HTTPS. I think the choice is pretty clear that we should default to HTTPS.

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.

2 participants