最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to automatically set 'default image size' for specific Custom Post Type

programmeradmin2浏览0评论

I'm looking to automatically set the default image size in the WordPress WYSIWYG, but only on certain Custom Post Types. For example, my CPT 'products' would default to 'medium', and CPT 'staff' would default to 'full'.

I've used the following code below to update media sizes for all CPT's, not just a specific one. Is this possible?

Here is the code I'm using for site-wide definitions:

function custom_image_size() {
  update_option('image_default_size', 'full' );
}

add_action('after_setup_theme', 'custom_image_size');
发布评论

评论列表(0)

  1. 暂无评论