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

    Sorry if this has a really simple solution, but I couldn’t find it in the MODx manager or forum.
    How do I change the ID of a page in the manager?

      • 4310
      • 2,310 Posts
      Don’t think you can’t change it from the Manager.
      You could go into the database and change it via PHPMyAdmin or whatever program is available.
      Table = modx_site_content, and the field = id
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You shouldn’t do that. The id is set by the database as an auto-increment. It is used internally by MODx to connect the document with its children and any TVs. It really doesn’t matter what the ID is for any other purpose. You can have your site_start document (home) be #42 and it won’t make a bit of difference.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 18839
          • 39 Posts
          Worked perfectly David, thanks

          Susan, do you think it’s ok to just change the id of the original home page doc to 49, and then set up a new doc which automatically gets an id of 50.
          Then to change the id of the newly created doc (50) to 1...
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            My personal take on this is that it’s going to a lot of trouble and risking getting too many things mixed up for no purpose. What difference does it make what ID any given document has? Just so it looks pretty when you look at the document tree? Because that’s all it will do. I’ve gotten to the point where I don’t even notice the ID except when I need to use it for Wayfinder or Ditto or something.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 4310
              • 2,310 Posts
              I certainly don’t recommend editing the DB directly in normal circumstances.
              I’ve had to do something to get the menu sorted correctly on a MySQL 5.0.51 server.
              On a smaller site I’ve swapped the page content from one id to another to get the desired effect.
              However on a larger site I found it easier to manipulate the id’s in the DB either directly or by exporting the table as a CSV file and editing as required.
              The auto increment still seems to work, starting at the number following the current highest id.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Ah, 5.0.51 is another matter. Fortunately I’ve never had to deal with that. tongue
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org