Just of the top of my head, something along this way might work:
function wpse178647_rewrite() {
add_rewrite_rule(
'^([^/]+)/([^/]+)/?$', ''
'index.php?category_name=$matches[1]&pagename=$matches[2]',
'top'
);
}
add_action( 'init', 'wpse178647_rewrite' );
Completely and utterly untested.
Related Posts:
- How to create non-unique sub-category slugs?
- Using a portfolio_category slug in wordpress URL
- Viewing category pages without the word ‘category’ in URL
- Redirect to another page using contact form 7? [closed]
- How do I add a tag slug to a category URL to filter posts?
- Change of category structure will cause two kinds of URLs for one post
- A different permalink structure for different categories
- How to remove category name for only one category?
- Change the full slug for a specific category?
- How can I get rid of the the category suffix–NOT “prefix” (i.e. foo-1, foo-2, etc)
- Posts URL structure like site.com/category/the-post-title
- How to get permalinks with category base working with sub-categories
- How to remove the term “category” from category pagination?
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- How do I get the category URL from get_the_category?
- How do I use the same post slug for different Categories?
- What’s the URL for a category archive?
- How to create a custom url for a category [closed]
- Add forward slash on categories url (serve one version of a url)
- Using URL parameters, list posts from category and custom taxonomy
- Create terms when registering taxonomy?
- Rewrite category wordpress
- Rewrite category slug
- How to Include the Parent and Child Category in the Permalink if the Post is Added to Both
- Using same slug name for a page and category
- Add category to custom post type automatically, using category slug
- Exclude subcategories from the url
- I use same slug name for category and page
- Divi change project slug based on category
- Removing the number in a category slug
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Page with the same name of a category
- Plural Category Base Slug On Category Archive Page
- Return category slug / title from category ID
- WooCommerce change category url and product base
- Duplicate Category and Page URL loads Category instead of the Page
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- Default category link for a custom category is a broken link
- Category slug $_SERVER[‘REQUEST_URI’];
- How to set up Author archives with sub category URL
- Get the name an the description of a link category
- What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?
- Custom page slug without creating a WP page
- WooCommerce duplicate sub categories and product slugs
- Need to pull parent category and slug – only pulling daughter category
- Should the actual /category/ directory be 404? Is that normal WP behaviour
- Add “page-a” slug to category link if user visit category link from “page-a”
- Pagination for category slug returns 404 when page >= 2
- Rewrite a category
- How do I get rid of “category” from my URL structure?
- Displaying a full post instead of a slug per category?
- How to change category and year archive permalinks/rewrite rules?
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- Category archive rewrite rule to include category/subcategory?
- The default code for “posts_nav_link” on category.php isn’t working
- How do I toggle pagination on/off in search results and category listings via a link?
- Mod_Rewrite to show only last subcategory in URL
- Remove subcategory and category with some rules from permalink
- Custom category URL rewriting
- menu using category and tags
- Get posts from specific taxonomy term
- Have multiple category queries from the URL been fixed yet?
- how to get full category path including parent and subcategories
- Hierarchical permalink structure for posts showing categories and sub-categories
- Nicer URL for viewing category of posts?
- What Must to Display the “mysite.com/category” URL?
- Change slug of Standard wp Post category
- How to remove the category from post slug
- Echo Category Nicename
- Global navigation in multisite: problem with categories
- Include specific category in URL automatically
- WooCommerce Product category can be shown with multiple related URLs
- pagination 404 error, same slug home and categories
- Different post slug based on archive
- Allow two posts (from different categories) to have the same slug
- OK to redirect the root WordPress category slug?
- How Can I Use Equal And Question Mark In Category Slug?
- Get nice name of category from slug (remove dashes of category)
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- Is this process OK to replace URL structure?
- Can a Woocommerce product category URL contain “&”?
- Category page 404s on mobile but not desktop?
- Include a page’s “category” in its URL
- Using the slug of a custom post category as prefix for the underlying custom post slugs
- Remove “category” from permalink with add_rewrite_rule
- Get category from slug list
- Accessible Subcategory URL’s pages without using .php hack
- How to auto update post title and slug with category name when post status is updated
- Hide category name using mod_rewrite
- Get full control over custom post type url
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Show only one of the categories of a post in the breadcrumb?
- hierarchical taxonomy in permalinks? using same slug
- Category slug not showing for Custom Post Type
- Category slug in in loop always the same?
- Page permalink rewrite
- Multiple Parent Category URLs
- How to get category slug link? ( include parent categories)
- How to add custom prefix before category base for category page URL?
- wordpress category rewrite rule with pagination