Home › Forums › Backend Issues (wp-admin) › Conditional branch to "Preview Size" on edit screen in diffrent custon post type › Reply To: Conditional branch to "Preview Size" on edit screen in diffrent custon post type
Dear John Huebner.
Thank you for your quick reply.
It works fine as below.
in functions.php
function my_acf_modify_img_field($field) {
if(get_post_type() === 'Post Type A') {
$field['preview_size'] = 'preview_for_A';
} elseif(get_post_type() === 'Post Type B') {
$field['preview_size'] = 'preview_for_B';
}
return $field;
}
add_filter('acf/prepare_field/name=cf_my_img', 'my_acf_modify_img_field');
I deeply appreciate you.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.