Auto-set permalink structure during setup if plain/default detected#13
Open
coleplx wants to merge 3 commits intoWordPress:trunkfrom
Open
Auto-set permalink structure during setup if plain/default detected#13coleplx wants to merge 3 commits intoWordPress:trunkfrom
coleplx wants to merge 3 commits intoWordPress:trunkfrom
Conversation
Contributor
There was a problem hiding this comment.
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 SAVEQUERIESfrom 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 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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also, on line 895, added
|| trueto prevent the script from failing and exiting silently whenwp config get SAVEQUERIESreturns false.Motivation:
The script kept failing on
single-idledue to permalinks being disabled. The requested path returned WordPress' default 404 HTML. 😞