• I’m having some permalink/url rewrite issues with WP Store Locator.

    In my site’s Settings > Permalinks I have it set to Custom Structure with “/our-story/blog/%postname%/” set. This is being used to define where blog posts should reside.

    In the WPSL Permalink Settings, I’ve enabled Permalinks, and set the Store to “branches” and Category to “branch-type”.

    If I click on the permalink for a store, it takes me to this URL:
    {my domain}/our-story/blog/branches/{store’s slug}

    How do I strip out the “/our-story/blog” from the URL of the wpsl_stores post type, while retaining this structure for blog posts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jsites

    (@jsites)

    I found the issue, and have a fix for it, but it would require changing something minor in the plugin.

    In the wp-store-locator/inc/class-post-types.php file, on line 43 we have this:

    $rewrite = array( 'slug' => $wpsl_settings['permalink_slug'] );

    if this line was changed to this:

    $rewrite = array( 'slug' => $wpsl_settings['permalink_slug'], 'with_front' => false );

    This would then clear out the blog post’s permalink settings, so that the Stores can use their own permalink settings independent of the blog.

    Thread Starter jsites

    (@jsites)

    I wanted to bump this post again. Is it possible to implement my fix into the plugin’s code? Right now, every time I update the plugin on sites built with it, I have to go back into the plugin code on each site and change this line to include the ‘with_front’ => false

    Plugin Author Tijmen Smit

    (@tijmensmit)

    There’s no need to modify the plugin code after an update, you can use the wpsl_post_type_args filter to modify the values from the functions.php.

    add_filter( 'wpsl_post_type_args', 'custom_post_type_args' );
    
    function custom_post_type_args( $args ) {
    
        global $wpsl_settings;
    
        $args['rewrite'] = array( 'slug' => $wpsl_settings['permalink_slug'], 'with_front' => false );
    
      return $args;
    }

    It’s untested, but you get the idea.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Permalink Structure (ignore Settings>Permalink)’ is closed to new replies.