WPSEO_Sitemap_Image_Parser::get_image_item PHP Method

get_image_item() protected method

Get image item array with filters applied.
protected get_image_item ( WP_Post $post, string $src, string $title = '', string $alt = '' ) : array
$post WP_Post Post object for the context.
$src string Image URL.
$title string Optional image title.
$alt string Optional image alt text.
return array
    protected function get_image_item($post, $src, $title = '', $alt = '')
    {
        $image = array();
        /**
         * Filter image URL to be included in XML sitemap for the post.
         *
         * @param string $src  Image URL.
         * @param object $post Post object.
         */
        $image['src'] = apply_filters('wpseo_xml_sitemap_img_src', $src, $post);
        if (!empty($title)) {
            $image['title'] = $title;
        }
        if (!empty($alt)) {
            $image['alt'] = $alt;
        }
        /**
         * Filter image data to be included in XML sitemap for the post.
         *
         * @param array  $image {
         *                      Array of image data.
         *
         * @type string  $src   Image URL.
         * @type string  $title Image title attribute (optional).
         * @type string  $alt   Image alt attribute (optional).
         * }
         *
         * @param object $post  Post object.
         */
        return apply_filters('wpseo_xml_sitemap_img', $image, $post);
    }