Table of Contents
If you want to change the slug or name of the item in our WordPress Directory theme that appears in the website URL (e.g. http://domain.xy/item/some-item) or some other keyword for other post types and taxonomies you can do it pretty easy following the instructions below.
Note please, after permalinks change may be required to resave permalinks structure in the database. Simply navigate to the WordPress Permalinks page and click save to force WordPress to save a new structure into the database.
Change slug from plugin files
Item slug in URL
In the file of Ait Toolkit plugin ./wp-content/plugins/ait-toolkit/cpts/item/@item.cpt.php you have to add a new part rewrite as you can see on the following image.
Item slug in breadcrumbs
If you want to change also the slug which appears in the breadcrumbs you must change the name parameter of the labels section:
Taxonomy slug
In the exact same way, you can change the slugs for categories, locations, or any taxonomies. Taxonomy of the post type is specified in the same file ./wp-content/plugins/ait-toolkit/cpts/item/@item.cpt.php
Important: If you can’t access any item or category after this modification and the only you get is the 404 – Nothing Found page. Keep in mind that this modification will be replaced by original files each time the Ait Toolkit plugin is updated!
Change slug from functions.php
The following example is used for advanced users or developers, we do not guarantee broken functionality using your own incorrectly implemented code example.
If you are using a child theme, a better way to change slugs of post types or taxonomies (archive pages) may be using filters inside your functions.php file in child theme:
/* CHANGE SLUGS OF CUSTOM POST TYPES */ function change_post_types_slug( $args, $post_type ) { /*item post type slug*/ if ( 'ait-item' === $post_type ) { $args['rewrite']['slug'] = 'my-new-item-slug'; } /*standard event post type slug*/ if ( 'ait-event' === $post_type ) { $args['rewrite']['slug'] = 'my-new-event-slug'; } /*portfolio post type slug*/ if ( 'ait-portfolio-item' === $post_type ) { $args['rewrite']['slug'] = 'my-new-portfolio-slug'; } /*event pro post type slug, available with Events Pro plugin*/ if ( 'ait-event-pro' === $post_type ) { $args['rewrite']['slug'] = 'my-new-eventpro-slug'; } return $args; } add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 ); /* CHANGE SLUGS OF TAXONOMIES, slugs used for archive pages */ function change_taxonomies_slug( $args, $taxonomy ) { /*item category*/ if ( 'ait-items' === $taxonomy ) { $args['rewrite']['slug'] = 'my-new-category-slug'; } /*item and event pro locations*/ if ( 'ait-locations' === $taxonomy ) { $args['rewrite']['slug'] = 'my-new-location-slug'; } /*item and event pro locations*/ if ( 'ait-portfolios' === $taxonomy ) { $args['rewrite']['slug'] = 'my-new-portfolios-slug'; } /*event pro category, available with Events Pro plugin*/ if ( 'ait-events-pro' === $taxonomy ) { $args['rewrite']['slug'] = 'udalosti'; } return $args; } add_filter( 'register_taxonomy_args', 'change_taxonomies_slug', 10, 2 );
Similar way you can change other parameters used for the registered post type.