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

Question

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');

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-automatically-set-default-image-size-for-specific-custom-post-type/">

How to automatically set 'default image size' for specific Custom Post Type</a>
0
, , Ghost Echo 2 months 0 Answers 62 views 0

Leave an answer