Hey Jason,
You’re right — the issue comes from having two versions of ACF active (the free plugin and the bundled Pro version from Bricks Advanced Themer). Since the Pro version already includes everything in the free one, WordPress automatically deactivates the standalone ACF Free plugin to prevent conflicts.
You can safely delete the free version — your fields and data will remain intact as long as Bricks Advanced Themer (and its bundled ACF Pro) stay active. Just make sure to back up your site before uninstalling, in case you ever switch themes or need the standalone plugin again.
Also, if you’re testing your site’s performance, check out the 7 prisoners movies you can see in this app (download for free from ciinemaapk.com.br/cinema-apk-preto/ ) — it’s a solid example of how fast-loading, well-optimized content can keep users engaged and reduce bounce rates.
Hope that clears things up!
— Alex
Hi sabrinazeiden,
You’re absolutely right about using the select2_args filter – that’s the correct approach since Taxonomy fields use Select2 but don’t expose the “Stylized UI” option. Here’s the JavaScript that will remove the search box:
javascript
acf.add_filter(‘select2_args’, function(args, $select, settings) {
// Check if this is a taxonomy field
if (settings.field_type === ‘taxonomy’) {
// Remove the search functionality
args.minimumResultsForSearch = -1;
}
return args;
});
Alternative approach – if you want to target specific taxonomy fields by their key or name:
javascript
acf.add_filter(‘select2_args’, function(args, $select, settings) {
// Target by field key
if (settings.field_key === ‘field_1234567890abc’) {
args.minimumResultsForSearch = -1;
}
// OR target by field name
if (settings.field_name === ‘your_taxonomy_field_name’) {
args.minimumResultsForSearch = -1;
}
return args;
});
Where to add this code:
In your theme’s JavaScript file that loads in admin
Or in the ACF admin footer using this PHP:
php
add_action(‘acf/input/admin_footer’, function() {
?>
<script>
acf.add_filter(‘select2_args’, function(args, $select, settings) {
if (settings.field_type === ‘taxonomy’) {
args.minimumResultsForSearch = -1;
}
return args;
});
</script>
<?php
});
The minimumResultsForSearch = -1 trick tells Select2 to never show the search box, regardless of how many options there are. This is much cleaner than trying to hide it with CSS.
This should completely remove the search dropdown from your Taxonomy select fields while keeping the regular Select fields unaffected.
Hi oliwa,
This is a known behavior with the new enable/disable feature that’s affecting several developers. The issue occurs because when ACF processes flexible content layouts, it checks the enabled/disabled state sequentially. Once it encounters a disabled layout, it appears to stop processing or hide subsequent layouts in that flexible content field – even global layouts loaded by post ID.
Here are two workarounds you can implement immediately:
Workaround 1: Reorder with Disabled Layouts at Bottom
The quickest fix is to drag all disabled layouts to the very bottom of your flexible content field. Since ACF processes layouts in order, keeping active layouts at the top ensures your global layouts will render correctly.
Workaround 2: Custom Filter to Bypass Disabled Check
Add this to your theme’s functions.php to force all layouts to render regardless of enabled/disabled status:
php
add_filter(‘acf/pre_render_fields’, function($fields, $post_id) {
// Only target flexible content fields
if (is_array($fields)) {
foreach ($fields as &$field) {
if ($field[‘type’] === ‘flexible_content’) {
// Ensure all layouts are treated as enabled
if (isset($field[‘layouts’])) {
foreach ($field[‘layouts’] as &$layout) {
$layout[‘enabled’] = true;
}
}
}
}
}
return $fields;
}, 10, 2);
Workaround 3: Alternative Global Layouts Approach
Consider using acf/load_field to programmatically add your global layouts instead of the post ID method:
php
add_filter(‘acf/load_field/name=your_flexible_content_field’, function($field) {
// Get your global layouts from CPT
$global_layouts = get_posts(array(
‘post_type’ => ‘global_layouts’,
‘posts_per_page’ => -1
));
foreach ($global_layouts as $layout_post) {
// Add each global layout programmatically
$field[‘layouts’][$layout_post->post_name] = array(
‘key’ => ‘layout_’ . $layout_post->post_name,
‘name’ => $layout_post->post_name,
‘label’ => $layout_post->post_title,
‘display’ => ‘block’,
‘enabled’ => true // Force enabled
);
}
return $field;
});
The core issue seems to be that the enabled/disable feature doesn’t properly handle mixed content (local layouts + global post ID layouts). I’d recommend reporting this to the ACF support team as a bug, as this definitely shouldn’t be the expected behavior.
In the meantime, Workaround 1 is your safest bet for immediate results. The filter approach (Workaround 2) is more comprehensive but test thoroughly on a staging site first.
Hope this helps you get back on track!
Hi jnrmy,
You’re very close! The issue is in your DateTime::createFromFormat() call. You’re using the format ‘Ymd’ which expects a string like “19900517”, but ACF date fields by default return the date as “Ymd” format – which is exactly what you’re getting from get_field().
The problem is you’re then trying to create a new DateTime object from the result, but $date is already a DateTime object. Here’s the corrected code:
php
<?php
$date_string = get_field(‘person-birthday’, $post->ID);
if($date_string) {
$birthday = DateTime::createFromFormat(‘Ymd’, $date_string);
$today = new DateTime();
$interval = $birthday->diff($today);
// Display the original date in your preferred format
echo $birthday->format(‘d M Y’); // Shows “17 May 1990”
// Display the age
echo ‘ (‘ . $interval->y . ‘ ans)’;
}
?>
Key fixes:
Removed the redundant new DateTime($date) – $date is already a DateTime object
Added a check to ensure the date field isn’t empty
Used $birthday->format() to display the date in a readable format
Created $today as a separate DateTime object for the comparison
Alternative simpler approach:
If you prefer a more concise version:
php
<?php
$birthday = get_field(‘person-birthday’, $post->ID);
if($birthday) {
$age = date_diff(date_create($birthday), date_create(‘today’))->y;
echo date(‘d M Y’, strtotime($birthday)) . ‘ (‘ . $age . ‘ ans)’;
}
?>
The main issue was creating a DateTime object from another DateTime object, which was resetting the date. Try the first solution and it should display the correct age!
Let me know if you’re still seeing “0” after this fix.
Hi Kyllian,
You’ve actually diagnosed the problem perfectly – this is indeed a hook timing issue where the post meta is being saved before your calculated field updates. The acf/save_post hook fires at different priorities, and your calculation is likely running too late in the sequence.
Here’s a cleaner solution that should fix the two-save requirement:
1. Replace Your PHP Snippet with Efficient ACF Logic
Instead of using a separate shortcode, handle the calculation directly within your ACF setup. Add this to your functions.php:
php
function calculate_completion_percentage( $post_id ) {
// Define all your file fields
$file_fields = array(‘cni’, ‘rib’, ‘justif’, ‘lettre’, ‘der’, ‘situation’);
$filled_count = 0;
// Count how many fields have files
foreach( $file_fields as $field ) {
if( get_field($field, $post_id) ) {
$filled_count++;
}
}
// Calculate percentage
$percentages = array(0, 17, 33, 50, 67, 83, 100);
$completion = isset($percentages[$filled_count]) ? $percentages[$filled_count] : 0;
// Update the ACF field directly
update_field(‘sum’, $completion, $post_id);
return $completion;
}
2. Hook with Correct Priority
Now hook this function to run at the right time during save:
php
// Run after ACF has saved all fields but before post is fully committed
add_action(‘acf/save_post’, ‘update_completion_on_save’, 15);
function update_completion_on_save( $post_id ) {
// Only run for main posts (not revisions)
if( wp_is_post_revision($post_id) ) {
return;
}
calculate_completion_percentage( $post_id );
}
3. Update Your Query Code
Your query logic is fine, but just ensure you’re clearing any cache:
php
$args = array(
‘posts_per_page’ => -1,
‘post_type’ => ‘post’,
‘meta_key’ => ‘sum’,
‘meta_value’ => ‘100’,
‘cache_results’ => false, // Disable caching for real-time results
‘update_post_meta_cache’ => false
);
$the_query = new WP_Query( $args );
$the_count = $the_query->found_posts; // More efficient than counting posts
wp_reset_postdata();
echo $the_count;
Why This Works:
The priority 15 in acf/save_post ensures your calculation runs AFTER ACF has saved the file fields but BEFORE the post save process completes
Direct field updating with update_field() is more reliable than shortcode processing
Counting filled fields is more efficient than your array filtering approach
This should eliminate the two-save requirement and give you real-time completion percentages. The key is ensuring your calculation happens at the right moment in the save sequence.
Try this approach and let me know if it resolves the timing issue!
Hi there,
This is a classic conflict between Gravity Forms’ AJAX processing and your theme’s or another plugin’s JavaScript. When the shortcode is in the flexible content field, it’s likely being loaded dynamically after the initial page render, which can break Gravity Forms’ JavaScript initialization.
Here are the most effective troubleshooting steps to resolve this:
1. The jQuery Re-Trigger Method (Most Common Fix)
Gravity Forms relies on jQuery events that fire on page load. Since your flexible content field loads after this, you need to manually re-trigger GF’s initialization. Add this to your theme’s functions.php or a custom plugin:
php
add_action( ‘wp_footer’, ‘reinitialize_gravity_forms’, 99 );
function reinitialize_gravity_forms() {
if ( ! is_admin() ) {
?>
<script type=”text/javascript”>
jQuery(document).ready(function($) {
// Re-initialize Gravity Forms conditional logic
if (typeof window[‘gform’] !== ‘undefined’) {
gform.initCondLogic();
}
// Re-bind Gravity Forms AJAX events
if (typeof window[‘gformInitPriceFields’] !== ‘undefined’) {
gformInitPriceFields();
}
});
</script>
<?php
}
}
2. Check for JavaScript Conflicts
Temporarily switch to a default WordPress theme (like Twenty Twenty-Four) and disable all other plugins except Gravity Forms and ACF. If the AJAX works, you’ve confirmed it’s a conflict. Re-enable elements one by one to identify the culprit.
3. Gravity Forms-Specific Solution
In your form settings, try disabling AJAX temporarily to see if the conditional logic still works without the scrolling issue. If it does, the problem is definitely with the AJAX re-initialization.
4. DOMContentLoaded Alternative
Sometimes wrapping the re-initialization in a DOMContentLoaded event helps:
javascript
document.addEventListener(‘DOMContentLoaded’, function() {
if (typeof window[‘gform’] !== ‘undefined’) {
gform.initCondLogic();
gform.initializeOnLoaded();
}
});
The key is ensuring Gravity Forms’ JavaScript re-initializes after your flexible content field fully loads into the DOM. The jQuery method above typically resolves this in about 80% of similar cases I’ve encountered.
Let us know which approach works for your setup!
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.