Support » Plugin: Multisite Language Switcher » Entry links on multi site missing "blog" in URL

Viewing 15 replies - 1 through 15 (of 30 total)
  • Plugin Author Dennis Ploetner



    do you refer to posts as entries? Or is this another post_type?

    Sorry with entries I mean the normal posts.

    Plugin Author Dennis Ploetner


    This should work out of the box with posts. Please provide a URL where I can check this.

    This web page points to the same post on the dutch site. The link generated is this while it should have been this. Again this is a multi site installation.

    Plugin Author Dennis Ploetner


    It is, of course, a multisite installation. The Multisite Language Switcher does not work in a single site.

    So you have a multisite with subdirectories instead of subdomains. How did you set the permalinks for the posts?

    The permalink type has been selected as Post name.
    I might add that the /blog/ part is already included in the fixed part of all options except the standard one (also for category and tag).

    And I also do not have subdirectories in real. The subdirectory is set virtually by WP multi site. I do not have subdomains.

    Plugin Author Dennis Ploetner


    I know the configuration of multisites very well as you can probably imagine. 😉

    And the interesting part is – because the WordPress function get_permalink doesn’t know that there is a prefix – how do you set ist that there is a /blog/ prefix: a plugin, did you write /blog/ in the permalink config… ?

    If I execute the get_permalink() function on a test site (off-line but has the same structure with the /blog part) the /blog part is normally included in the url. So permalink function knows this. As said the permalink options in the general settings offer the /blog part in the greyed out area so I haven’t put this in there.
    I installed multi site months ago and this is my first installation like this. When I was satisfied with my test site I cloned the lot according to a description I found on the net. So the /blog part remained.
    If I look in the detailed settings for a multi site the option “Permalink structure” has been set to /blog/%postname%/. Here I can obviously remove the /blog part. But I would rather not go that way as I think the /blog part is a good addition (to discern from pages).
    Is there a WP function available that gives you the permalink prefix?
    Or should I just plainly remove the /blog part for option “Permalink structure”?

    The detailed settings can be viewed through this url:

    Plugin Author Dennis Ploetner


    OK, all this is a little bit clearer now. The blog part is normally set in the primary blog of a multisite installation.

    You can override the get_permalink function in the plugin with a filter. You should test this but you can then just put it in your functions.php:

    function my_msls_options_get_permalink( $url, $language ) {
        if ( 'post' == get_post_type( get_the_ID() ) ) {
            $count = 1;
            $url   = str_replace( home_url(), '', $url, $count );
            $url   = home_url( '/blog/' . $url );
        return $url;
    add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );

    This will add /blog/ to every post.


    Why would I want to add /blog/ to every post URL? That part is already there or not?

    And if this part is normally set in the primary blog of a multi site why can’t the plug-in pick this up and create the correct url itself?

    Plugin Author Dennis Ploetner


    I have no idea how your setup is. You refer to a test of another site and I have still no useful info how the permalink settings of these sites are done. Remember these are set in every single site. What I offered is a work-a-round to add the blog-slug to posta btw…

    The main problem now is that I cannot post screen images so you can see exactly what my permalink options are. The test site I was referring to has exactly the same set-up as the site I am reporting the problem for. On the test site I can experiment and check the values of get_permalink and get_home_url functions by echoing. This I do not want to do on my production site.
    Is there a way to put images in here as an attachment (so you can see the permalink options automatically include the /blog part)?

    As you stated this name /blog was apparently chosen by me when I initially set up the multi site. As this seems to be a normal feature of multi site I ask why this part is not incorporated into the urls generated by MLS plug-in?
    Or is my only way to solve this problem by the removal of the /blog name in “Permalink structure” option?

    Is there some other information that you perhaps need to be able to pin-point this problem?

    Plugin Author Dennis Ploetner


    You can put the screenshots anywhere. The only thing is that I prefer to not to have to register me for a new service. 😉

    The problem in you case is that MSLS is indeed processing the rewrite rule but has no indication for a prefix so it removes the blog part. It is important to understand this to be able to offer a proper solution…

    Problem is that I never put screen shots on some open site. You cannot post them in here directly?

    I was trying to locate where you can see the permalink structure. It is in the table wp_options as option_name permalink_structure (but you probably know that).
    I suppose MSLS knows what the blog id is of the site that it is pointing to?
    For posts URLs you cannot pick up the string from the same option_name in the wp_n_options table (where n is the blog id)?

    Just a thought: what will happen if someone chooses a different permalink structure in only one of his multi sites? Will the URLs for posts also be wrong for that particular site?

    Plugin Author Dennis Ploetner


    You can send the screenshots to me:

    MSLS doesn’t use the tables but switch_to_blog() and can then access the options for the particular site.

    You can set the permalink structure in every site however you like. 😉

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘Entry links on multi site missing "blog" in URL’ is closed to new replies.