Skip to content

Add filter for post preload URLs - #1109

Open
cbratschi wants to merge 1 commit into
Automattic:trunkfrom
cbratschi:codex/add-preload-url-filter
Open

Add filter for post preload URLs#1109
cbratschi wants to merge 1 commit into
Automattic:trunkfrom
cbratschi:codex/add-preload-url-filter

Conversation

@cbratschi

Copy link
Copy Markdown

Summary

  • add a narrow wpsc_preload_post_url filter around the permalink selected by the preload worker
  • pass the post ID so multilingual and other compatibility layers can resolve the correct URL
  • preserve the existing get_permalink() result when no filter is registered
  • add WordPress integration coverage for both the default and filtered URL

Context

The preload worker queries published post IDs directly and resolves every URL in the current request language. Multilingual integrations therefore cannot select the language associated with each post without patching the preload worker or changing global language state.

This generic hook adds the missing extension point without adding a dependency on WPML or changing existing behavior. A compatibility layer can inspect the supplied post ID and return the language-specific permalink.

Related: #876

Testing

  • composer lint
  • php vendor/bin/phpunit -c phpunit.9.xml.dist --colors=always — 84 tests, 111 assertions
  • make test-integration — 55 tests, 151 assertions

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.

1 participant