Remove all the pages except few in MODx

I am a complete noobie in MODx. I started working for one of our client websites which were built in MODx and their website is gonna migrate to different CMS but they want to keep two pages and rest of the pages they don’t want, header, footer, admin panel, etc. Only the content of those two pages (For these two pages data are fetching from database). Is it possible to keep these two pages and remove the rest of the pages?

What came to my mind first is to unpublish all the pages and change the edit the template but there are lots of pages (Site is Multilingual) and it will be a lot of work, is there any easy way to do it?

Sorry for the bad English

MODX Revolution 2.7.0-pl

The simplest and safest way would be to right-click on each resource you want to delete in the Resource tree and select “delete”.

That will mark them for deletion. Once they’re all marked (or you can do them in batches), click on the little trash can icon above the top of the tree to fully delete them.

You could also select “Unpublish” instead of delete for some or all of them if there’s any chance that you might want them back in the future.

It’s not a bad idea to back up the database first in case you make any mistakes.

You could write a custom snippet to cycle through all resources and delete any that are not in the group you want to save, but there is some risk of either leaving behind records connecting pages to templates or TVs or making a mistake in the code that would delete resources you want to keep.

1 Like

If you are keeping MODX running to serve those two page I wouldn’t bother deleting all the pages. Instead I would:

  • backup the database (I always backup the database before making changes)
  • go into the ‘site-content’ table with phpMyAdmin or the mysql client and set the ‘published’ field to ‘0’
  • go into the Manager and check the ‘published’ box on the pages you want

Once that is done you can go back into the ‘site-content’ table and delete all records where published=‘0’. But I don’t see any advantage in doing that.

1 Like

Thanks Bob Unpublishing the resource seems a good idea.

Thanks Timrca these seems to be the fastest way but unfortunately I don’t have database access. I can only contact the server guy to backup the database.

Can’t you use the Batcher extra from within the MODX Manager?