Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.
/ dynamic-wp-config Public archive

Dynamically conifugre paths in your WordPress config file.

Notifications You must be signed in to change notification settings

LSVH/dynamic-wp-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic WordPress config

Travis-CI Packagist Packagist downloads Open issues Starred on GitHub

Dynamically conifugre paths in your WordPress config file.

Installation

Open a terminal in the same folder as your wp-config.php file.

composer require lsvh/dynamic-wp-config

Afterwards you should add the following to the top of your wp-config.php file.

require_once __DIR__ . '/vendor/autoload.php';

Usage

Usually you will do something like...

use \LSVH\WordPress\DynamicConfig\Init as DynamicConfig;

define('WP_HOME', DynamicConfig::url_with_path());
define('WP_SITEURL', DynamicConfig::url_with_path());

Syntax

url_with_path($install_dir = '')

Returns the full URL to the WordPress site.

force_protocol($to = 'https')

Redirect the WordPress website to a particular HTTP protocol.

  • string $to: The protocol to redirect to (Default is 'https').
force_subdomain($to = 'www.')

Redirect the WordPress website to a particular subdomain.

  • string $to: The subdomain to redirect to (Default is 'www.').
avoid_subdomain($from = 'www.')

Redirect the WordPress website to the domain without subdomain to avoid the given subdomain.

  • string $from: The subdomain to avoid (Default is 'www.').
force_domain($to)

Redirect the WordPress website to a particular domain.

  • string $to: The domain to redirect to.

License

MIT © LSVH

About

Dynamically conifugre paths in your WordPress config file.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages