Skip to content

Auto-set permalink structure during setup if plain/default detected#13

Open
coleplx wants to merge 3 commits intoWordPress:trunkfrom
coleplx:trunk
Open

Auto-set permalink structure during setup if plain/default detected#13
coleplx wants to merge 3 commits intoWordPress:trunkfrom
coleplx:trunk

Conversation

@coleplx
Copy link
Copy Markdown

@coleplx coleplx commented Apr 30, 2026

Also, on line 895, added || true to prevent the script from failing and exiting silently when wp config get SAVEQUERIES returns false.

Motivation:
The script kept failing on single-idle due to permalinks being disabled. The requested path returned WordPress' default 404 HTML. 😞

@coleplx coleplx marked this pull request as draft May 1, 2026 15:14
@coleplx coleplx marked this pull request as ready for review May 1, 2026 15:45
@desrosj desrosj requested a review from Copilot May 5, 2026 01:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the setup flow in rtc-test.sh to reduce failures caused by WordPress installs using “Plain” permalinks and to prevent set -e from aborting setup when SAVEQUERIES is not defined in wp-config.php.

Changes:

  • Auto-detect “Plain/default” permalink structure and attempt to switch to /%postname%/ during WP-CLI setup.
  • Prevent wp config get SAVEQUERIES from aborting the script when the constant is unset by appending || true.
  • Update manual setup instructions to include enabling pretty permalinks and renumber the steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rtc-test.sh Outdated
Comment thread rtc-test.sh
Comment on lines +823 to +829
local perm_struct
perm_struct="$(wp "${WP_FLAGS[@]}" option get permalink_structure 2>/dev/null)" || perm_struct=""
if [ -z "${perm_struct}" ]; then
printf 'Permalinks: default (query-string) -- setting to /%%postname%%/\n'
wp "${WP_FLAGS[@]}" rewrite structure '/%postname%/' --hard >/dev/null 2>&1 \
|| die "Could not set permalink structure. Set it manually: Settings > Permalinks."
printf 'Permalinks: set to /%%postname%%/\n'
Comment thread rtc-test.sh
Comment on lines +825 to +829
if [ -z "${perm_struct}" ]; then
printf 'Permalinks: default (query-string) -- setting to /%%postname%%/\n'
wp "${WP_FLAGS[@]}" rewrite structure '/%postname%/' --hard >/dev/null 2>&1 \
|| die "Could not set permalink structure. Set it manually: Settings > Permalinks."
printf 'Permalinks: set to /%%postname%%/\n'
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants