Fixed default content for WSOD
parent
c7a67365e7
commit
38675dd6a0
|
@ -444,7 +444,7 @@ fi
|
||||||
if [[ ! -f "index.php" || ! -f "wp-includes/version.php" || ! -d "wp-admin" ]]; then
|
if [[ ! -f "index.php" || ! -f "wp-includes/version.php" || ! -d "wp-admin" ]]; then
|
||||||
info "WordPress core files seem missing or incomplete. Downloading..."
|
info "WordPress core files seem missing or incomplete. Downloading..."
|
||||||
# Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS
|
# Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS
|
||||||
if ! $SUDO_CMD $WP_EXECUTABLE core download "${WP_RUN_ARGS[@]}" --skip-content --version=latest; then
|
if ! $SUDO_CMD $WP_EXECUTABLE core download "${WP_RUN_ARGS[@]}" --version=latest; then
|
||||||
error_exit "Failed to download WordPress core files using WP-CLI."
|
error_exit "Failed to download WordPress core files using WP-CLI."
|
||||||
fi
|
fi
|
||||||
success "WordPress core downloaded."
|
success "WordPress core downloaded."
|
||||||
|
@ -607,6 +607,19 @@ if ! $SUDO_CMD $WP_EXECUTABLE core is-installed "${WP_RUN_ARGS[@]}"; then
|
||||||
# Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS
|
# Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS
|
||||||
$SUDO_CMD $WP_EXECUTABLE plugin delete akismet hello "${WP_RUN_ARGS[@]}" --quiet || warning "Could not delete default plugins (might not exist)."
|
$SUDO_CMD $WP_EXECUTABLE plugin delete akismet hello "${WP_RUN_ARGS[@]}" --quiet || warning "Could not delete default plugins (might not exist)."
|
||||||
|
|
||||||
|
# Ensure a default theme is activated (uses Twenty Twenty-Four or fallback to any available theme)
|
||||||
|
info "Ensuring a default theme is activated..."
|
||||||
|
if $SUDO_CMD $WP_EXECUTABLE theme is-installed twentytwentyfour "${WP_RUN_ARGS[@]}"; then
|
||||||
|
$SUDO_CMD $WP_EXECUTABLE theme activate twentytwentyfour "${WP_RUN_ARGS[@]}" || warning "Could not activate Twenty Twenty-Four theme"
|
||||||
|
else
|
||||||
|
# Get first available theme and activate it
|
||||||
|
FIRST_THEME=$($SUDO_CMD $WP_EXECUTABLE theme list --status=inactive --field=name --format=csv "${WP_RUN_ARGS[@]}" | head -n 1)
|
||||||
|
if [[ -n "$FIRST_THEME" ]]; then
|
||||||
|
info "Twenty Twenty-Four not found. Activating $FIRST_THEME theme instead."
|
||||||
|
$SUDO_CMD $WP_EXECUTABLE theme activate "$FIRST_THEME" "${WP_RUN_ARGS[@]}" || warning "Could not activate $FIRST_THEME theme"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
success "WordPress installed successfully via WP-CLI."
|
success "WordPress installed successfully via WP-CLI."
|
||||||
else
|
else
|
||||||
info "WordPress is already installed according to WP-CLI."
|
info "WordPress is already installed according to WP-CLI."
|
||||||
|
|
Loading…
Reference in New Issue