-
Notifications
You must be signed in to change notification settings - Fork 209
/
define-site-url.ts
35 lines (33 loc) · 1.05 KB
/
define-site-url.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { StepHandler } from '.';
import { defineWpConfigConsts } from './define-wp-config-consts';
/**
* Changes the site URL of the WordPress installation.
*
* @inheritDoc defineSiteUrl
*/
export interface DefineSiteUrlStep {
step: 'defineSiteUrl';
/** The URL */
siteUrl: string;
}
/**
* Sets [`WP_HOME`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#blog-address-url) and [`WP_SITEURL`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-siteurl) constants for the WordPress installation.
*
* Using this step on playground.wordpress.net is moot.
* It is useful when building a custom Playground-based tool, like [`wp-now`](https://www.npmjs.com/package/@wp-now/wp-now),
* or deploying Playground on a custom domain.
*
* @param playground The playground client.
* @param siteUrl
*/
export const defineSiteUrl: StepHandler<DefineSiteUrlStep> = async (
playground,
{ siteUrl }
) => {
await defineWpConfigConsts(playground, {
consts: {
WP_HOME: siteUrl,
WP_SITEURL: siteUrl,
},
});
};