Skip to content

Conversation

@jazzsequence
Copy link
Contributor

Fixes #178
Consolidates #181 into fewer commits

The linked issue is somewhat misrepresented. While the observed behavior is accurate (malformed URLs) it is not because of a misplaced /wp in the REST url -- WP-API URLs on Bedrock-based sites are expected to have two /wp/ strings in them -- one being the path to the application and the second is part of the actual wp-json/ URL (e.g. /wp-json/wp/v2/...). Therefore, the proposed solution would actually break sites without addressing the issue.

Since the issue only exists on newly created sites, the assumption here is that these sites are not using "pretty permalinks". Indeed, our tests assume permalinks are pretty for this very reason. In cases when "pretty permalinks" are not active, it makes sense that API requests might fail due to our URL rewriting for internal paths.

This PR works around the issue by simply accepting "pretty"-style API endpoint paths while also preserving the functionality of "plain" permalinks. Both "plain" and "pretty" permalinks are henceforth supported by the REST API for WPCM sites.

Tests are broken out into #182 so as to not mix release and non-release commits and will fail until this PR is merged.

Tests have been integrated back into this PR as well as other non-release changes. As a result, this PR MUST BE merged with a merge commit, not squash merge.

@jazzsequence jazzsequence requested review from a team as code owners May 8, 2025 21:14
@github-actions
Copy link

github-actions bot commented May 8, 2025

Hi from your friendly robot! 🤖
Please review the commit checks for this PR:

This PR contains a mixture of 'normal' (release) commits and 'non-release' (internal) commits. This requires careful merging (e.g., rebase and merge) to ensure only 'normal' commits are deployed to public upstream if that's the intent.

If issues are present, please ensure commits modify either 'normal' or 'non-release' files (not a mix within a single commit) and do not contain forbidden files.
If this PR intentionally mixes 'normal' and 'non-release' commit types, remember to use rebase and merge rather than squash when merging to preserve individual commit integrity for the deploy process.

@jazzsequence jazzsequence self-assigned this Jun 27, 2025
@jazzsequence jazzsequence merged commit 6f750fb into default Jul 1, 2025
14 checks passed
@jazzsequence jazzsequence deleted the devrel-29-fix-subdir-wpms-url-issue-3 branch July 1, 2025 20:26
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.

[DEVREL-29] 404 errors when accessing wp-json from WPMS subsites

3 participants