Way to change over 5000 pages Page Type without clicking them one by one?

Permalink
Hi there,

does anyone have suggestion of how I could change Page Type of very many pages without clicking them one by one?

If this can't be do I hope someone at least has solution of how I could filter page list results with Page Template instead?

Right now I have:
$list->filterByCollectionTypeHandle('optional_equipment');

but all the pages have a Page Type of "Page" so I would have to change them all to "Optional equipment"

Cheers, Petro

 
rge replied on at Permalink Best Answer Reply
You need to get the results of the list and loop trough the pages.
foreach ($pages as $page) {
    $page->update(['ptID' => 23]); // fill in your page type id
}

It might be a good idea to paginate the result so you don’t run into memory issues.
JohntheFish replied on at Permalink Reply
JohntheFish
If you know the before and after page type ID, you could write a SQL statement to hack this directly in the database from the MySQL command line or phpMyAdmin.

Not the most correct way of doing it, but quick for a one-off change.
rge replied on at Permalink Reply
That is allot faster indeed the Query would look something like this.

UPDATE Pages
SET ptID = 21
WHERE ptID = 5;


21 - the new Page Type ID
5 - the old Page Type ID