If you want to change a stores slug URL store name, please place the function below into your child theme:
add_filter( 'register_post_type_args', 'wpse247328_register_post_type_args', 10, 2 ); function wpse247328_register_post_type_args( $args, $post_type ) { if ( 'stores' === $post_type ) { $args['rewrite']['slug'] = 'interactive-map'; } return $args; }
Hi,
I added the code above to the child theme and saved permalinks, but the slugs are still as the example below
https://northumberlandwi.org.uk/store/wylam/
Please ignore / remove / delete my previous comment, I was working between a test site and a live site so its no wonder updating the test site did not affect the live site!
Works like a dream, thanks for the swift response and sorry for the doh! moment
I added the function script into the child theme and it’s changed the slug but the single location pages are coming back with “page not found”.
Do you have a script that will change the slug for store category pages as well?
You can read here on how to change a custom taxonomy slug.
Hi ! How to also change it in Breadcrumbs ?
Thank you so much !
That is up to your third party plugin or theme who is creating the breadcrumbs.
Hi, I’ve used the script but I had some strange behaviour.
– the pages i created where not reachable (404)
– when i tried to edit a post from the admin panel i got the message that I was not allow to edit that type of post
– when I reloaded the page the plug in was no more present in the sidebar (like wordpress disable it)
Could you please help me?
Thank you
Please go to wp-admin and save permalinks once.
HI when I add the code I get an error on the panel
This is the first line:
Warning: array_merge(): Expected parameter 2 to be an array, string given in /home/uxyqauyg/domains/xxx.it/public_html/xxx/wp-includes/class-wp-post-type.php on line 422
Can you help me?
thank you
The args code must be $args[‘rewrite’][‘slug’] – we corrected above FAQ.
Hi!
It’s possible to change the stores slug URL store name to have it with different languages?
With WPML I tried to do this, but it doesn’t work. Only works the first condition:
add_filter( ‘register_post_type_args’, ‘wpse247328_register_post_type_args’, 10, 2 );
function wpse247328_register_post_type_args( $args, $post_type ) {
if ( ‘stores’ === $post_type && ICL_LANGUAGE_CODE==’en’ ) {
$args[‘rewrite’][‘slug’] = ‘auto-repair’;
}
if ( ‘stores’ === $post_type && ICL_LANGUAGE_CODE==’es’ ) {
$args[‘rewrite’][‘slug’] = ‘taller-coche’;
}
if ( ‘stores’ === $post_type && ICL_LANGUAGE_CODE==’it’ ) {
$args[‘rewrite’][‘slug’] = ‘autofficina’;
}
return $args;
}
Please contact WPML support for this
Hi, is posible to use customerid in unique store page (slug URL) example domain.com/store/customerid
You can change the store slug to your customer ID of course.
one by one? there is no way to do it automatically? by snippet for example
one by one? there is no way to do it automatically? by snippet for example