Skip to content

Installing WordPress core in a subdirectory聽#24

Description

@szepeviktor

Directory structure

/index.php
/wp-config.php
/wp-content/
/project/ 馃憟馃徎 WordPress core, change this name to a non-generic word, e.g. the project slug

/index.php

<?php

/** Tell WordPress to load the WordPress theme and output it. */
define('WP_USE_THEMES', true);

/** Load the WordPress Environment and Template. */
require __DIR__ . '/project/wp-blog-header.php';

/wp-config.php

<?php

// "wp-content" location.
define('WP_CONTENT_DIR', __DIR__ . '/wp-content');
define('WP_CONTENT_URL', 'https://example.com/wp-content');

Update options with WP-CLI

wp option update home "https://example.com"
wp option update siteurl "https://example.com/project"

Login URL: https://example.com/project/wp-admin/


// Don't redirect automatically to admin
remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);

https://developer.wordpress.org/reference/functions/wp_redirect_admin_locations/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions