block-visibility icon indicating copy to clipboard operation
block-visibility copied to clipboard

Create new filter hook on `run_acf_rule_tests`

Open seemly opened this issue 1 year ago • 0 comments

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;
});
Screenshot 2023-07-03 at 20 07 24

seemly avatar Jul 03 '23 19:07 seemly