Skip to content

importer: use page if a post and page clash with slugs#175

Draft
ahayzen-kdab wants to merge 1 commit intowagtail:mainfrom
ahayzen-kdab:fix-clashing-posts-and-pages
Draft

importer: use page if a post and page clash with slugs#175
ahayzen-kdab wants to merge 1 commit intowagtail:mainfrom
ahayzen-kdab:fix-clashing-posts-and-pages

Conversation

@ahayzen-kdab
Copy link
Copy Markdown

This is due to an upstream issue with wordpress where if you set permalink to /%postname%/ it allows a
page and post to have the same slug. But when viewing via the slug wordpress always picks the page.
https://core.trac.wordpress.org/ticket/13459

(Description)

Ticket URL:


Testing

  • CI passes
  • If necessary, tests are added for new or fixed behaviour
  • These changes do not reduce test coverage

Documentation.

  • This PR adds or updates documentation
  • Documentation changes are not necessary because:

@ahayzen-kdab
Copy link
Copy Markdown
Author

You may not want this in your code, but could be useful for others who hit this issue.

This is due to an upstream issue with wordpress where
if you set permalink to /%postname%/ it allows a
page and post to have the same slug. But when viewing
via the slug wordpress always picks the page.
https://core.trac.wordpress.org/ticket/13459
# We are creating a new page as the wp_post_id doesn't exist
# however we may have a collision of slugs between page and post types
# https://core.trac.wordpress.org/ticket/13459
slug_post = self.page_model_class.objects.get(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

note if wp_post_parent support from #176 was added, this would need to consider a slug_post with the same parent as the page and not just any slug page

@nickmoreton nickmoreton added the waiting for after 0.3.1 release A better time to consider this is after the package is next released, planned 0.3.1 label May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for after 0.3.1 release A better time to consider this is after the package is next released, planned 0.3.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants