WireArray::insertBefore() method

Insert an item before an existing item


$items->insertBefore($newItem, $existingItem); 


$wireArray->insertBefore($item, $existingItem);


itemWire, string, int

Item you want to insert.

existingItemWire, string, int

Item already present that you want to insert before.

Return value


Object instance it was called from (method supports fluent interface).

WireArray methods and properties

API reference based on ProcessWire core version 3.0.214

Twitter updates

    Error retrieving Twitter status

Latest news

  • ProcessWire Weekly #473
    In the 473rd issue of ProcessWire Weekly we'll check out latest core updates, introduce new third party module called Template Fragment Controller, and more. Read on!
    Weekly.pw / 3 June 2023
  • A look at the new Page Edit Restore module
    The new Page Edit Restore module helps to prevent page edits in the admin from getting lost when the user’s session is lost. This post covers it in detail.
    Blog / 12 May 2023
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer