We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    Hi there,

    I'm migrating a wordpress.com website to MODX 2.2.4, using the Articles' 1.6.2. Wordpress import function and the tutorial which can be found here: http://modx.com/learn/modx-college/migrating-from-wordpress/. All works fine, except the imported articles (more than 220) didn't get their aliases (it's blank). I see in core/components/articles/model/articles/import/articlesimportwordpress.class.php on line 171:

    'alias' => $this->parseContent((string)$wp->post_name),


    Which seems to be ok, because my Wordpress XML file has post names like:
    <wp:post_name>this-is-the-title-of-a-post</wp:post_name>


    I tried to change the code mentioned above to:
    'alias' => $this->parseContent((string)$item->post_name),

    but that didn't work. No aliases are being generated.

    Don't know if it have anything to do with it, but when I click save on the Wordpress importer dialogue, the "Please wait" loading dialogue stays loading for ever..

    Is this a know bug in the Articles Wordpress import function?
      • 19328
      • 433 Posts
      Filed as a bug here: http://tracker.modx.com/issues/8447

      Temporary fix: I've set up an snippet which scans all articles for an alias, and when there is no alias, it creates one on the fly.

      Create a snippet autoAlias with the code below, and run it once.

      <?php
      /* AutoAlias snippet */
      echo 'Setting Aliases';
      
      $resources = $modx->getCollection('modResource', array('class_key'=>'Article'));
      
      if (empty($resources)) {
       
      return "No Resources Found";
      
      }
       
      foreach ($resources as $resource) {
      
          if ($resource->get('alias') == '') {
      echo 'gedaan.<br />';
      								$resource->set('alias',$resource->cleanAlias($resource->get('pagetitle')));
              $resource->save();
               
          }
      
      } 
       
      return 'Done!';