[marketpress] Product URL change, after updating Marketpress to the latest version

Hi there,

I recently upgraded my Marketpress plugin.

While enabling and settling the plugin in there - used the "quick setup" option =( , I didnt realize when it changed my permalinks for the products ... I call my products "tutorials" ... and the plugin changed the URL structure to calling them "products" back. Google traffic is meeting a page not found error for each product (about 4500 products) for at least one sub site: "chin".

I request earliest possible help! Ive also enabled for you to access the website dashboard.

So far Ive checked the permalinks setting through the Network-->sites-->edit ... but that didnt undo anything.

Have backups until just before the changes, but want to keep this version of plugin.

Appreciate all your help.

  • Sajid
    • DEV MAN’s Sidekick

    Hello graphitewpmud,
    Hope you are doing good today :slight_smile:

    I am sorry to hear you accidentally changed the slug. Could you please tell me from what MarketPress version you updated from ?

    I could not find a way to change the rewrite slug of an existing post type. But I come up at following code that should do the trick here.

    Please note that it would not actually replace the slug, but instead will redirect all the url of tutorials to matching products with store/products.

    function add_custom_rewrite_rule() {
        // First, try to load up the rewrite rules. We do this just in case
        // the default permalink structure is being used.
        if( ($current_rules = get_option('rewrite_rules')) ) {
            // Next, iterate through each custom rule adding a new rule
            // that replaces 'movies' with 'films' and give it a higher
            // priority than the existing rule.
            foreach($current_rules as $key => $val) {
                if(strpos($key, 'movies') !== false) {
                    add_rewrite_rule(str_ireplace('store/products', 'tutorials', $key), $val, 'top');
                } // end if
            } // end foreach
        } // end if/else
        // ...and we flush the rules
    } // end add_custom_rewrite_rule
    add_action('init', 'add_custom_rewrite_rule');

    Try adding the above code in functions.php file of your child theme or use it as mu-plugin.

    If you go with mu-plugin route then, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:


    I have also pinged the developer here to get his feedback too in order to completely override the url slug.

    As soon as I will hear back from the developer I will post a reply here. Meanwhile, please use the above code.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

  • graphitewpmud
    • Design Lord, Child of Thor

    Dear Sajid,

    Thanks for the pointers; I appreciate the care.
    To answer your questions first, I upgraded from I believe 2.8.3 (bu..404@gm....com is another account that we use with you guys, and I believe we last purchased in 2014 so around then...) ... never felt the need to update since all functions were being met all this time, and now Ive broken what was fixed.
    Im really eager to see what the developer says, and how this could even be possible... all relevant plugins are from WPMU ... and nothing like this has ever happened... have used this plugin since before it was called Marketpress.

    I just wish we can find a way to completely undo it ... so redirection may not be needed.

    Im a bit too disoriented to try and figure if new products being added will be affected with this redirection, so I hope we can undo this.

    I also wonder, if I restore back to a safe stage - and then reinstall the plugin, without doing the "quick setup" ... if Id be able to avoid the problem/issue...

    Once again, thank you thus far!!

  • graphitewpmud
    • Design Lord, Child of Thor

    I would like to bring fwd something more serious.

    The URLs have not merely shaken off their slugs.

    4700 products, worth hours and hours of upload and preparation work over four years are showing as trashed.

    Given piling losses - and more than that, traffic which is meeting broken links, it appears that I need to take the risk of reverting back updates using whatever backups are available.

    Its disconcerting that an update can change things so much.

    Its uncertain what the future will be like continuing with this plugin.

  • Sajid
    • DEV MAN’s Sidekick

    Hello graphitewpmud,

    I am really sorry to hear you are getting such a serious issues. The reason I asked you from what version you upgraded from is that we had a very major release of MarketPress plugin (version 3x).

    Right now, the best option is revert back to previous working version of MarketPress plugin to get your site back.

    Now, create the staging/development version of your site on same server and try the update their.

    Then update the plugin on staging site instead of live site right away.

    Once you will update the plugin on staging site and start configuring then let me know if you need assistance with renaming the URL structure back to tutorials and I will flag it to developer. One of our developer will take a deeper on look on your site.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

  • graphitewpmud
    • Design Lord, Child of Thor

    Hi Sajid,

    Ive managed to restore from my backup, but this is the message I see now: Warning: Invalid argument supplied for foreach() in /home/motherfolder/public_html/sitename.com/wp-content/plugins/marketpress/marketpress.php on line 2686

    If they couldnt find the products earlier, now that will creep them out too much to proceed ...

    Any suggestions?


  • Sajid
    • DEV MAN’s Sidekick

    Hello graphitewpmud,
    Hope you are doing good today :slight_smile:

    These are just warnings and notices for developers only (however we still consider these as bugs and fix them up - since you rolled back to older version of plugin so I would not flag it as a bug because I am sure it has already been fixed in the latest version).

    So, if every thing else is working just fine then you can simply ignore these warnings/notices by setting the WP_DEBUG flag from true to false in wp-config.php file.

    Please see WordPress official documentation to disable the debugging.

    If it broke the functionality, then please enable support staff access so I could take a closer look and also please share the link, screenshot or any thing that can help understand this issue.

    To grant access go to WPMU DEV -> Support -> Support Access -> Grant Support Access or see this manual for more details regarding how to enable support staff access.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.