WP_CLI\Fetchers
Comment{}
Fetch a WordPress comment based on one of its attributes.
No Hooks.
Usage
$Comment = new Comment(); // use class methods
Methods
- public get( $arg )
Comment{} Comment{} code WP-CLI 2.8.0-alpha
class Comment extends Base { /** * The message to display when an item is not found. * * @var string */ protected $msg = 'Could not find the comment with ID %d.'; /** * Get a comment object by ID * * @param string $arg The raw CLI argument. * @return WP_Comment|array|false The item if found; false otherwise. */ public function get( $arg ) { $comment_id = (int) $arg; $comment = get_comment( $comment_id ); if ( null === $comment ) { return false; } return $comment; } }