Home › Forums › Backend Issues (wp-admin) › Alter field group settings per content type › Reply To: Alter field group settings per content type
Using $_GET to grab the post id worked great. Thanks so much.
Here’s the final function:
function toind_alter_flexible_content( $field_group ) {
if ( isset( $_GET['post'] ) ) {
$post_id = intval( $_GET['post'] );
$post_type = get_post_type( $post_id );
if ( 'group_5c76d2e8213cf' === $field_group['key'] && 'event' === $post_type ) {
$field_group['menu_order'] = 7;
$field_group['position'] = 'normal';
}
}
return $field_group;
}
add_filter( 'acf/validate_field_group', 'toind_alter_flexible_content', 20 );
Thank you again so much for all of your help.
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.