Please add this code in functions.php to remove the “category” text from permalink.
function remove_category( $string, $type ) {
if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) ){
$url_without_category = str_replace( "/category/", "/", $string );
return trailingslashit( $url_without_category );
}
return $string;
}
add_filter( 'user_trailingslashit', 'remove_category', 100, 2);
Related Posts:
- Allow two posts (from different categories) to have the same slug
- How to get URL of current page displayed?
- How to Remove Parents Category Permalink from Posts
- Put a link to a category round a hard coded A HREF
- How is WordPress manipulating the posts like there are folders?
- How to use $_GET function WordPress backend
- Create custom permalinks to show Custom Post Type’s relationship?
- WordPress permalink issue
- Get nice name of category from slug (remove dashes of category)
- Child-Theme Category View with modified permalinks (%category% removed)
- Rewrite rule not working, but only when parameter is text
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Get WordPress username to customize url
- WordPress/NGINX not respecting the category URL for new posts
- Custom content using in_category
- How do I generate formatted permalinks as specified in backend options?
- How to extract URLs from wordpress taxonomies
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- How to create a custom url for a category [closed]
- exclude multiple terms using get_terms() function
- how to get permalink structure with php
- Dynamic URL to reference custom PHP files
- Archive listing of posts by publish year (multiple years)
- Add custom field to attachments in a specific category
- WooCommerce change category url and product base
- Get a permalink structure of /%posttype%/%category%/%postname%
- Newbie question: no index.php? in my plain wordpress permalink
- wordpress upgrade has broken my permalinks
- Creating a related post section based on similar categories
- Add prefix to link url
- Issue adding sub category programmatically
- php script to change slug in post automatically
- Grab posts by multiple categories
- Colon is Missing In My Website Url in WordPress
- Customize permalink wordpress category id
- how to save selected option in variable for rest api category filter
- Display category name only once inside loop
- how to show only specific category for a template
- How to array only one key from another array
- Displaying posts based on category
- Post’s ID pattern?
- Get categories names as an array to use it in theme settings
- Change product_base programmatically
- How to get the last category name of a child category?
- Divi change project category slug
- How to separate categories with commas?
- Show all tags within a category?
- Custom post type permalinks do not appear using the link functions
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Remove slugs from custom posts type
- Alphabetically Ordered Category in WordPress
- change default RSS feed URL
- Loading Posts & Category with Ajax
- How to get current category
- WooCommerce: Display product categories to make IF statement
- Nginx WordPress and another Web app URL structure
- Creating customized php files in theme folder
- Creating a Category Taxonomy
- Show parent categories of the current category
- How to check if a category has a parent and child categories?
- Comment_author_url doing nothing
- Get category id when SEO URL is turned on
- Insert PHP code in Text
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Categories Listing and Highlighting current category item
- Display Sibling WooCommerce Product Categories on Archive Page
- Workaround for og:image unsupported webp image type, Yoast SEO?
- understand what code is doing when prepending /blog
- display the months of a specific category
- Add Custom Category Description When Empty
- Can I show category name in url for only one of my categories?
- List sub categories and corresponding posts of a parent category
- 404 on old link after changing post url
- Dropdown category field inside repeatable metabox
- url not using query string no longer working
- Add Link to PHP message
- Permalink changes after several minutes after saving post
- How to edit button permalink inside function.php using a child theme?
- How to show category just on specific pages?
- All categories options or All categories not Populating
- Permalinks and custom PHP application
- How to add style in functions.php depending on conditions?
- How do I display Category titles on a WP Page?
- problem with category menu, it doesn’t want to show link
- WordPress Rewrite Issue
- Saving category as insert post
- get_category only returning details for ‘uncategorized’
- Get permalink for a post from inside WordPress and route to a related site
- Hide empty categories from get_categories
- Make a permalink to the most recent blog post
- on category page get name of category as a string
- WordPress categories not working throughout site
- PHP code for link with text
- Display a list of posts corresponding to a category
- How to create categories out of a list of words?
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- Create a custom plugin with dynamic child pages listing database records
- Remove slug of multiple custom post types with and without hierarchical