In case anyone needs it, this is working for my needs:
add_filter('acf/get_field_group', 'my_change_field_group');
function my_change_field_group($group) {
$get_current_screen = get_current_screen();
$get_current_post_type = $get_current_screen->post_type;
$my_option = get_field('my-option','option');
if (
$get_current_post_type == 'my-cpt' &&
$my_option == 'stuff' &&
$group['key'] == 'group_123456789'
) {
$group['location'] = array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'my-cpt',
),
),
);
}
return $group;
};
Related Posts:
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Search with filters and title
- How to apply a filter to an ACF wysiwig editor field output?
- Hide Posts In Back-end/Admin Based On User’s (Pseudo) Privileges Controlled by ACF
- Filter Pages by Custom Field (ACF) in admin area
- Create new custom field that calculates age
- Save something to global var in add_filter
- Conditionally including JS based on whether ACF field is set [closed]
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- Not able to change wp_title using add_filter
- LESS CSS enqueue_style with add_filter to change rel attribute
- Remove Editor From Homepage
- What do add_filters() and apply_filter() do?
- SSL certificate for the host could not be verified
- What to use instead of the content_save_pre filter?
- Moving sharedaddy buttons (in Jetpack) to the top of a post?
- How can I customize the wp_list_categories
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Can’t change a label in woocommerce with the normal filter
- WordPress RSS feed – filter RSS content by custom field value
- Add classname to the_category() function?
- Filter the URL of next_posts_link & previous_posts_link
- Sensei LMS Hooks to Remove Content
- How to re-enable a filter after disabling with __return_false
- Archive filter disappears on no results?
- Exclude One Category and its Subcategories using WP_LIST_FILTER
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- Gutenberg disable the “block” tab in right sidebar
- Where is this inline CSS code [closed]
- When to use actions and when to use filters
- add_filter to ‘woocommerce_before_main_content’ [closed]
- Editing
- the_content filter – checking the post
- add_filter to apply_filters that exists within class
- Echoing Categories only if they’re a child of a given category
- Why in archive page doesn´t show read more button with excerpt?
- Removal of Jetpack OG Tags from old blog site
- Adding a title prefix with the the_title filter
- How to removes all instances of thumbnails displayed in my theme?
- How to modify an existing meta description?
- Adding TinyMCE buttons without removing plugin buttons?
- Don’t see add_filter result in the site front page
- How can I include an existing custom sitemaps listing in wp-sitemap.xml?
- Display Externally Retrieved Data within a Custom Template
- Can the wordpress color palettes by changed through Javascript?
- Filter on the_content doesn’t update the content being searched via register_rest_route
- Where to add_filter in theme functions.php?
- Cannot change the definition of AUTOMATIC_UPDATER_DISABLED
- tag removed not using a filter
- How to customize the “Insert/edit link” popup box?
- WordPress Image update filter
- How to remove this filter?
- Why does WordPress strip custom HTML that are form elements and theme SVG icons?
- Trouble using remove_filter to override function in parent theme
- Load Posts’ individual body content on index starting at char 200 of each post
- How can you wrap add_filter with a if is_home() statement?
- How to add attributes to WordPress Admin Sub Menu List Items
- How to combine multiple body classes
- Prepending character(s) to a custom tag title?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- How to replace username with email address in users table
- include specific Pages to wp_list_pages with filter
- why require – does not load filter
- term_link filter rewrite link only applying half of condition?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- Create a pre-filtered version of the Media Library
- What is the action hook to use if you want to capture the new password during password change?
- Get_template_part inside filter?
- How to filter Sidebar Content
- How would I use a filter to remove header banner on certain post types
- Need to return shortcode text instead of the output
- Change tags url to search different site
- Dashboard filter based on custom fields URL response code
- Customising the default wordpress search functionality
- I want to add string array to this function to filter displayed option in drpodown [closed]
- Function not returning correct value for found_posts filter
- Remove style tags from head
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- how to develop a filter in wordpress to let the user filter the page content depends on the date (newest to oldest etc…)?
- Print only parent categories of post in custom RSS feed
- WordPress: Issue with filtering users using date range
- Login logout below menu bar
- Use add_filter inside another function
- How to filter reading/visibility posts based on role?
- Admin view: filter posts by whether they have specific taxonomy attached
- Filter posts by categories ajax is showing all the posts
- URL to filter posts by post meta similar to shop/?product_cat=”painting”
- Incrementing content with extra text after save/publish
- Filter and validate user role in registration
- How to use a TinyMCE filter?
- Unable to get WordPress’s apply_filters(‘site_url’) to return a https scheme
- String Replace Caching & Chance of Collisions
- is_page_template() doesn’t work with excerpt_length filter
- Admin filter/error if post title is too long
- What is the scope and persistence of add_filter() and remove_filter()?
- GET form action. Redirect to self