Wire::warnings() method

Return or manage warnings recorded by just this object or all Wire objects

This method returns and manages warnings that were previously set by Wire::warning().

Example

// Get warnings for one object
$warnings = $obj->warnings();

// Get first warning in object
$warning = $obj->warnings('first');

// Get warnings for all Wire objects
$warnings = $obj->warnings('all');

// Get and clear all warnings for all Wire objects
$warnings = $obj->warnings('clear all');

Usage

// basic usage
$notices = $wire->warnings();

// usage with all arguments
$notices = $wire->warnings($options = []);

Arguments

NameType(s)Description
options (optional)string, array

One or more of array elements or space separated string of:

  • first - only first item will be returned
  • last - only last item will be returned
  • all - include all errors, including those beyond the scope of this object
  • clear - clear out all items that are returned from this method
  • array - return an array of strings rather than series of Notice objects.
  • string - return a newline separated string rather than array/Notice objects.

Return value

Notices array string

Array of NoticeWarning warnings, or string if last, first or str option was specified.


Wire methods and properties

API reference based on ProcessWire core version 3.0.248

Latest news

  • ProcessWire Weekly #582
    The 582nd issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
    Weekly.pw / 5 July 2025
  • New ProcessWire admin redesign
    When you upgrade to ProcessWire 3.0.248 or newer (currently the dev branch), you’ll immediately notice something new and beautiful…
    Blog / 9 May 2025
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer