john ellis
asked 9 years ago

I have WP, woocommerce with the store using the base dir and blog has /blog/ perma…
Here’s my permalink setup:

custom structure: /blog/%postname%/

The problem is the URL for my question categories has the blog in the URL:


I’d like to remove blog from the URL but keep my actual blog in the /blog/ directory, how can I do this?

1 Answers
answered 9 years ago

@john ellis: i’m not sure it gonna work correctly but you can try this :
You can open file : dw-question-answer\inc\templates\default\assets\js\dwqa-questions-list.js and then go to line 39, and change the funtion URLToArray() to this :

function URLToArray() {
        var url_str = $(location).attr('href');
        var url_str_arr = url_str.split('/');
            url_str_arr.splice( 3, 0, 'blog' );
        var url = url_str_arr.join('/');
        var request = {};
        var pairs = url.substring(url.indexOf('?') + 1).split('&');
        console.log( url )
        if (url.indexOf('?') >= 0) {
            for (var i = 0; i < pairs.length; i++) {
                var pair = pairs[i].split('=');
                request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
            return request;
        } else {
            return (new Array())

the code : url_str_arr.splice( 3, 0, 'blog' ); If your site is : http://your_site/ , the number will be 3 , if http://your_site/yoursub_domain then it will be url_str_arr.splice( 4, 0, 'blog' );

and after that , you go to line 169, inside funtion .done(function(resp)){}, change the code to :

if (resp.success) {
                    if (history.pushState)
                          var url =;
                       var res = url.replace(/[^.*]blog/, '');
                        console.log( res );
                        window.history.pushState(null, document.title, res);


Not sure it work correctly for filter all question.Hope this help, Glad.

replied 9 years ago

It seems to work ok, although the status bar still shows /blog/ in the link which is not really a major issue – I suppose that could also be changed somewhere.

My only question, are there any potential security issues by doing this?

Just a couple of other things that put me off this plugin
1) Unable to create a custom single question page with shortcode
2) There’s no category list widget
3) Question category pages aren’t indexable as they’re generated with ajax so I couldn’t index the page and the page couldn’t be found in search engines by simply typing ‘my_product forum’
4) Also notice DW site has a seperate ‘topic’ feature as well as the category widget – that would be a cool feature.

If you added these and made category pages indexable I’d pay $50 for the plugin any day.

Thanks for your help.

dominic Staff
replied 9 years ago

I know what you want, however, we are busy with many our own new projects right now. So that we aren’t ready to start it, unfortunately 🙁 . Will consider, please stay tuned.

Powered by DW Question & Answer Pro