Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ahayzen-kdab
Copy link

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
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
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

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