block-visibility
block-visibility copied to clipboard
Create new filter hook on `run_acf_rule_tests`
I have added a new bv_run_acf_rule_tests_value
filter hook.
This means you can pass a shortcode into the Value
field in the UI and run do_shortcode
using the new filter before comparison.
This is useful when bulk importing posts using something like WP All Import, and you want to compare the value against a dynamically generated value defined in an ACF field on the current post.
add_filter('bv_run_acf_rule_tests_value', function($value) {
if(str_contains($value, '[acf field=')) {
return do_shortcode($value);
}
return $value;
});