how to reconstruct subsite url in wordpress multisite

Viewed 73

I have multi-site with folder structure and url example_site.com, and I need URL structure of sub-site to be example_site.com/locations/state/city.

I can't find the right hook i even tried pre_get_posts hook to change all pages and post but its ugly solution and multi-site will have over 30 sites.

 function filter_url( $url, $path, $blog_id, $scheme ) { 

      if($blog_id = 3){

            $url = str_replace('/city/','/locations/state/city/',$url); 
          }
         return $url; 
    }; 

If i try to echo the result of the function i get what i need but if I returned i get nothing

1 Answers

Make sure DNS is pointing the domain you want to use at the IP address where WP multisite is installed. Update the Site Address (URL) setting for the subsite you want to change Run Better Search and Replace on the old subsite domain to the new subsite domain (its default mode is a dry run which does not actually make changes but lets you see how many replacements it will make).

Related