Tribe__Repository::set_featured_image( string|int $image )
Sets the create args the repository will use to create posts.
Contents
Parameters
- $image
-
(string|int) (Required) The path to an image file, an image URL, or an attachment post ID.
Return
($this)
Source
File: src/Tribe/Repository.php
public function set_featured_image( $image ) {
if ( '' === $image || false === $image ) {
$thumbnail_id = false;
} elseif ( 0 === $image || null === $image ) {
$thumbnail_id = '';
} else {
$thumbnail_id = tribe_upload_image( $image );
}
if ( false === $thumbnail_id ) {
return $this;
}
return $this->set( '_thumbnail_id', $thumbnail_id );
}
Changelog
| Version | Description |
|---|---|
| 4.9.5 | Introduced. |