easy_svg_add_icon_result()
Stores one icon and returns its state, id and the slug it actually got.
Function · Easy SVG · Status: Internal · Defined in includes/icon-manager.php
Usage
easy_svg_add_icon_result( string $label, string $markup ): array
Example
$result = easy_svg_add_icon_result( 'Arrow right', $svg );
if ( 'added' === $result['state'] && $result['slug'] !== $result['wanted'] ) {
// The name was taken.
}
Description
Sanitizes and hardens the markup through easy_svg_accept_icon() with the upload bounds, inserts an esw_icon post with kses off for that insert, and deletes it again if what was stored has no svg. WordPress makes post_name unique, so a second Arrow becomes arrow-2; wanted carries the slug that was asked for. States: added, no_sanitizer, bad_name, empty, too_large, too_complex, not_svg, not_saved.
Parameters
Icon name, already sanitized as text. The slug is derived from it.
Raw SVG markup.
Return value
wanted is present only when added.