admin管理员组

文章数量:1430588

This question is with regard to feature images on WooCommerce product post types, however it should probably apply to any post type.

I am running a custom script to create new posts (of type product) and want to set the featured image to be an external URL, rather than importing the images to my server as the images are already served via CDNs.

A normal featured image sets _thumbnail_id in the wp_postmeta table, and the meta_value column then references the image details on wp_posts. Whilst I can probably manually create these database entries, I am wondering if there is a WordPress function to do this that I don't know about.

I'm looking for a programatic solution rather than any plugin suggestions.

本文标签: woocommerce offtopicSet Post Thumbnail to external URL