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

Don't generate unused rewrite rules for alerts post type #1380

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ocean90
Copy link
Contributor

@ocean90 ocean90 commented Nov 14, 2022

register_post_type() generates rewrite rules by default even if the post type isn't public. Two avoid this we can pass 'rewrite' => false.

Currently the rewrite_rules options also contains these rules:

  'wp_stream_alerts/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
  'wp_stream_alerts/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
  'wp_stream_alerts/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
  'wp_stream_alerts/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
  'wp_stream_alerts/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
  'wp_stream_alerts/[^/]+/attachment/([^/]+)/embed/?$' => 'index.php?attachment=$matches[1]&embed=true',
  'wp_stream_alerts/([^/]+)/embed/?$' => 'index.php?wp_stream_alerts=$matches[1]&embed=true',
  'wp_stream_alerts/([^/]+)/trackback/?$' => 'index.php?wp_stream_alerts=$matches[1]&tb=1',
  'wp_stream_alerts/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?wp_stream_alerts=$matches[1]&paged=$matches[2]',
  'wp_stream_alerts/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?wp_stream_alerts=$matches[1]&cpage=$matches[2]',
  'wp_stream_alerts/([^/]+)(?:/([0-9]+))?/?$' => 'index.php?wp_stream_alerts=$matches[1]&page=$matches[2]',
  'wp_stream_alerts/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
  'wp_stream_alerts/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
  'wp_stream_alerts/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
  'wp_stream_alerts/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
  'wp_stream_alerts/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
  'wp_stream_alerts/[^/]+/([^/]+)/embed/?$' => 'index.php?attachment=$matches[1]&embed=true',

With this change the above rules will be removed.

Checklist

  • Project documentation has been updated to reflect the changes in this pull request, if applicable.
  • I have tested the changes in the local development environment (see contributing.md).
  • I have added phpunit tests.

Release Changelog

  • Fix: Don't generate unused rewrite rules for alerts post type.

Release Checklist

  • This pull request is to the master branch.
  • Release version follows semantic versioning. Does it include breaking changes?
  • Update changelog in readme.txt.
  • Bump version in stream.php.
  • Bump Stable tag in readme.txt.
  • Bump version in classes/class-plugin.php.
  • Draft a release on GitHub.

Change [ ] to [x] to mark the items as done.

@ocean90
Copy link
Contributor Author

ocean90 commented May 15, 2024

@kasparsd Any chance we could get this merged?

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