Returns a WP_Image_Editor instance and loads file into it.
Parameters
$path
stringrequired- Path to the file to load.
$args
arrayoptional- Additional arguments for retrieving the image editor.
Default:
array()
Source
foreach ( $objects as $object ) {
$taxes = get_object_taxonomies( $object, $output );
if ( $taxes ) {
$taxonomies = array_merge( $taxonomies, $taxes );
}
}
if ( 'names' === $output ) {
$taxonomies = array_unique( $taxonomies );
}
return $taxonomies;
}
/**
* Retrieves all of the taxonomies that are registered for attachments.
*
* Handles mime-type-specific taxonomies such as attachment:image and attachment:video.
*
* @since 3.5.0
*
* @see get_taxonomies()
*
* @param string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'.
* Default 'names'.
* @return string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments.
*/
function get_taxonomies_for_attachments( $output = 'names' ) {
$taxonomies = array();
foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
foreach ( $taxonomy->object_type as $object_type ) {
if ( 'attachment' === $object_type || str_starts_with( $object_type, 'attachment:' ) ) {
if ( 'names' === $output ) {
$taxonomies[] = $taxonomy->name;
} else {
$taxonomies[ $taxonomy->name ] = $taxonomy;
}
break;
Changelog
Version | Description |
---|---|
3.5.0 | Introduced. |
Basic Example
Example: Check a broken image