get_home_path example


function make_site_theme_from_oldschool( $theme_name$template ) {
    $home_path   = get_home_path();
    $site_dir    = WP_CONTENT_DIR . "/themes/$template";
    $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;

    if ( ! file_exists( "$home_path/index.php" ) ) {
        return false;
    }

    /* * Copy files from the old locations to the site theme. * TODO: This does not copy arbitrary include dependencies. Only the standard WP files are copied. */
    

function network_step2( $errors = false ) {
    global $wpdb$is_nginx;

    $hostname          = get_clean_basedomain();
    $slashed_home      = trailingslashit( get_option( 'home' ) );
    $base              = parse_url( $slashed_home, PHP_URL_PATH );
    $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
    $abspath_fix       = str_replace( '\\', '/', ABSPATH );
    $home_path         = str_starts_with( $abspath_fix$document_root_fix ) ? $document_root_fix . $base : get_home_path();
    $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
    $rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';

    $location_of_wp_config = $abspath_fix;
    if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
        $location_of_wp_config = dirname( $abspath_fix );
    }
    $location_of_wp_config = trailingslashit( $location_of_wp_config );

    // Wildcard DNS message.     if ( is_wp_error( $errors ) ) {
        
'<p>' . __( '<a href="https://wordpress.org/documentation/article/customize-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';

if ( $is_nginx ) {
    $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/documentation/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
}

$help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>';

get_current_screen()->set_help_sidebar( $help_sidebar_content );
unset( $help_sidebar_content );

$home_path           = get_home_path();
$iis7_permalinks     = iis7_supports_permalinks();
$permalink_structure = get_option( 'permalink_structure' );

$index_php_prefix = '';
$blog_prefix      = '';

if ( ! got_url_rewrite() ) {
    $index_php_prefix = '/index.php';
}

/* * In a subdirectory configuration of multisite, the `/blog` prefix is used by * default on the main site to avoid collisions with other sites created on that * network. If the `permalink_structure` option has been changed to remove this * base prefix, WordPress core can no longer account for the possible collision. */

function save_mod_rewrite_rules() {
    global $wp_rewrite;

    if ( is_multisite() ) {
        return;
    }

    // Ensure get_home_path() is declared.     require_once ABSPATH . 'wp-admin/includes/file.php';

    $home_path     = get_home_path();
    $htaccess_file = $home_path . '.htaccess';

    /* * If the file doesn't already exist check for write access to the directory * and whether we have some rules. Else check for write access to the file. */
    if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks()
        || is_writable( $htaccess_file )
    ) {
        if ( got_mod_rewrite() ) {
            $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );

            
Home | Imprint | This part of the site doesn't use cookies.