Jump to content

What is the best way for ...

Recommended Posts

Hi all guys,

I have pages son of a Page, all with same template.

In this template I have so many fields. I want to check if there are pages with the same value of 1 of this 3 fields (a, b, c) and if yes delete one of this.
The main intent is to remove all duplicates pages checking by fields.

Anyone can suggest me a way?




Share this post

Link to post
Share on other sites

/* single out with selectors the pages you want to target */
$pageArray = $pages->findMany('template=name_of_template, field_name=value);

/* iterate through the selected pages and do something to each of them */

foreach($pageArray AS $key => $myPage) {

	/* Do something with the page */



Also check out the documentation for Selectors.
They are very powerfull and usefull.


Also check out the API docs for $page

And $pages

The API docs are my first stop when i am trying to figure out to do something in PW.

Good luck.


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...