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
- change the blog in the url if you go from a specific page wordpress
- Is it possible to go to the next post in the same category?
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- Add “page-a” slug to category link if user visit category link from “page-a”
- Add prefix to link url
- Proper syntax or method for keeping url in modified isotope / category links
- Filter Select results based on selection
- What is an equivalent of single_cat_title for getting the slug of the category?
- 200 Rewrite blog post links
- Issue adding sub category programmatically
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- php script to change slug in post automatically
- how do I get a specific post from a post with a subcategory in WP
- WP grandchild categories in nested ul li
- Grab posts by multiple categories
- Pass Category Name, Description and Photo into variables to pass to jQuery
- How to show single category archive
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Dynamic content based on a URL parameter
- Move category description below post list in blog
- How to pick the default selected value in wordpress dropdown?
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Colon is Missing In My Website Url in WordPress
- Get page that displays all children of taxonomy parent
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- WordPress every page is 404 not found including admin resources
- How to change redirection route to a php page for making it only accessible by logged-in members?
- WordPress returning 404 for multisite pages
- selected option if current category is the value
- get_template_part based upon post’s category
- Customize permalink wordpress category id
- how to save selected option in variable for rest api category filter
- Extend PHP regex to cover “srcset” and “style” attributes
- Setting default category base on theme activation
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Hide subcategories (widget)
- Alert Bar section within WP loop is displaying even though there are no posts
- Let Users Choose Post Categories
- Different post styles depending on category
- Display category name only once inside loop
- My php header() function is not working [closed]
- Scrape external webpage for first image and add it to new post
- Remove subcategory and category with some rules from permalink
- Search Query: how to construct a search string from two select elements?
- How to show only subcategories in parent category not parent category?
- Get URL Parameters from referer
- Need help enqueueing webfonts
- how to show only specific category for a template
- Redirect to another page using contact form 7? [closed]
- Dilemma of Populating all the categories in a drop down list
- Display most popular posts of category
- Creating sub-categories via php
- Define specific category name in PHP
- Why is $wp->request empty in WordPress 6.0?
- Get the URL of the page from which an ajax request has been launched within ajax callback
- Edit the_category (); for a hierarchical display
- JSON REST API WordPress only showing first 10 categories
- Category title output before opening title tag
- How to check if the current page is at a specified path in the URL?
- How to get post permalink url without a href
- get taxonomy thumbnail and use it as a variable in code
- Include Parent Term in wp_list_categories
- get_template_directory_uri() providing wrong path for img
- How to array only one key from another array
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- How to pass a PHP $_GET variable and fetch/output it?
- Get all categories post is not in
- Get latest post from all categories except one
- Displaying posts based on category
- stripping tags from excerpt in WordPress is not working
- Hierarchical permalink structure for posts showing categories and sub-categories
- Post’s ID pattern?
- How do I remove a category from a wordpress loop>
- Get categories names as an array to use it in theme settings
- Change product_base programmatically
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- How to get the last category name of a child category?
- Divi change project category slug
- In WordPress, how do I get the number of posts next to single_cat_title(”); in the category.php file?
- Use get() method to grab all categories and output inside another method