{"id":15896063,"url":"https://github.com/wp-cli/rewrite-command","last_synced_at":"2025-04-04T14:05:43.830Z","repository":{"id":45041110,"uuid":"88049190","full_name":"wp-cli/rewrite-command","owner":"wp-cli","description":"Lists or flushes the site's rewrite rules, updates the permalink structure.","archived":false,"fork":false,"pushed_at":"2025-03-22T10:06:35.000Z","size":8573,"stargazers_count":20,"open_issues_count":3,"forks_count":14,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-28T13:07:06.754Z","etag":null,"topics":["cli","hacktoberfest","rewrite","router","wordpress","wp-cli","wp-cli-package"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-12T12:27:48.000Z","updated_at":"2025-03-22T10:06:39.000Z","dependencies_parsed_at":"2024-10-18T14:48:10.599Z","dependency_job_id":"e67c24e2-1509-41fb-8b50-56705523aeea","html_url":"https://github.com/wp-cli/rewrite-command","commit_stats":{"total_commits":467,"total_committers":50,"mean_commits":9.34,"dds":0.708779443254818,"last_synced_commit":"0dd0d11918eaaf2fcad5bc13646ecf266ffa83e9"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frewrite-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frewrite-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frewrite-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frewrite-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-cli","download_url":"https://codeload.github.com/wp-cli/rewrite-command/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190231,"owners_count":20898700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest","rewrite","router","wordpress","wp-cli","wp-cli-package"],"created_at":"2024-10-06T09:05:35.939Z","updated_at":"2025-04-04T14:05:43.814Z","avatar_url":"https://github.com/wp-cli.png","language":"PHP","readme":"wp-cli/rewrite-command\n======================\n\nLists or flushes the site's rewrite rules, updates the permalink structure.\n\n[![Testing](https://github.com/wp-cli/rewrite-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/rewrite-command/actions/workflows/testing.yml)\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n\nThis package implements the following commands:\n\n### wp rewrite\n\nLists or flushes the site's rewrite rules, updates the permalink structure.\n\n~~~\nwp rewrite\n~~~\n\nSee the WordPress [Rewrite API](https://codex.wordpress.org/Rewrite_API) and\n[WP Rewrite](https://codex.wordpress.org/Class_Reference/WP_Rewrite) class reference.\n\n**EXAMPLES**\n\n    # Flush rewrite rules\n    $ wp rewrite flush\n    Success: Rewrite rules flushed.\n\n    # Update permalink structure\n    $ wp rewrite structure '/%year%/%monthnum%/%postname%'\n    Success: Rewrite structure set.\n\n    # List rewrite rules\n    $ wp rewrite list --format=csv\n    match,query,source\n    ^wp-json/?$,index.php?rest_route=/,other\n    ^wp-json/(.*)?,index.php?rest_route=/$matches[1],other\n    category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$,index.php?category_name=$matches[1]\u0026feed=$matches[2],category\n    category/(.+?)/(feed|rdf|rss|rss2|atom)/?$,index.php?category_name=$matches[1]\u0026feed=$matches[2],category\n    category/(.+?)/embed/?$,index.php?category_name=$matches[1]\u0026embed=true,category\n\n\n\n### wp rewrite flush\n\nFlushes rewrite rules.\n\n~~~\nwp rewrite flush [--hard]\n~~~\n\nResets WordPress' rewrite rules based on registered post types, etc.\n\nTo regenerate a .htaccess file with WP-CLI, you'll need to add the mod_rewrite module\nto your wp-cli.yml or config.yml. For example:\n\n```\napache_modules:\n  - mod_rewrite\n```\n\n**OPTIONS**\n\n\t[--hard]\n\t\tPerform a hard flush - update `.htaccess` rules as well as rewrite rules in database. Works only on single site installs.\n\n**EXAMPLES**\n\n    $ wp rewrite flush\n    Success: Rewrite rules flushed.\n\n\n\n### wp rewrite list\n\nGets a list of the current rewrite rules.\n\n~~~\nwp rewrite list [--match=\u003curl\u003e] [--source=\u003csource\u003e] [--fields=\u003cfields\u003e] [--format=\u003cformat\u003e]\n~~~\n\n**OPTIONS**\n\n\t[--match=\u003curl\u003e]\n\t\tShow rewrite rules matching a particular URL.\n\n\t[--source=\u003csource\u003e]\n\t\tShow rewrite rules from a particular source.\n\n\t[--fields=\u003cfields\u003e]\n\t\tLimit the output to specific fields. Defaults to match,query,source.\n\n\t[--format=\u003cformat\u003e]\n\t\tRender output in a particular format.\n\t\t---\n\t\tdefault: table\n\t\toptions:\n\t\t  - table\n\t\t  - csv\n\t\t  - json\n\t\t  - count\n\t\t  - yaml\n\t\t---\n\n**EXAMPLES**\n\n    $ wp rewrite list --format=csv\n    match,query,source\n    ^wp-json/?$,index.php?rest_route=/,other\n    ^wp-json/(.*)?,index.php?rest_route=/$matches[1],other\n    category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$,index.php?category_name=$matches[1]\u0026feed=$matches[2],category\n    category/(.+?)/(feed|rdf|rss|rss2|atom)/?$,index.php?category_name=$matches[1]\u0026feed=$matches[2],category\n    category/(.+?)/embed/?$,index.php?category_name=$matches[1]\u0026embed=true,category\n\n\n\n### wp rewrite structure\n\nUpdates the permalink structure.\n\n~~~\nwp rewrite structure \u003cpermastruct\u003e [--category-base=\u003cbase\u003e] [--tag-base=\u003cbase\u003e] [--hard]\n~~~\n\nSets the post permalink structure to the specified pattern.\n\nTo regenerate a .htaccess file with WP-CLI, you'll need to add\nthe mod_rewrite module to your [WP-CLI config](https://make.wordpress.org/cli/handbook/config/#config-files).\nFor example:\n\n```\napache_modules:\n  - mod_rewrite\n```\n\n**OPTIONS**\n\n\t\u003cpermastruct\u003e\n\t\tThe new permalink structure to apply.\n\n\t[--category-base=\u003cbase\u003e]\n\t\tSet the base for category permalinks, i.e. '/category/'.\n\n\t[--tag-base=\u003cbase\u003e]\n\t\tSet the base for tag permalinks, i.e. '/tag/'.\n\n\t[--hard]\n\t\tPerform a hard flush - update `.htaccess` rules as well as rewrite rules in database.\n\n**EXAMPLES**\n\n    $ wp rewrite structure '/%year%/%monthnum%/%postname%/'\n    Success: Rewrite structure set.\n\n## Installing\n\nThis package is included with WP-CLI itself, no additional installation necessary.\n\nTo install the latest version of this package over what's included in WP-CLI, run:\n\n    wp package install git@github.com:wp-cli/rewrite-command.git\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.\n\nFor a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should [search existing issues](https://github.com/wp-cli/rewrite-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/rewrite-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).\n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/rewrite-command/issues/new) to discuss whether the feature is a good fit for the project.\n\nOnce you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See \"[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)\" for details specific to working on this package locally.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support\n\n\n*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Frewrite-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-cli%2Frewrite-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Frewrite-command/lists"}