Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new filter hook on run_acf_rule_tests #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seemly
Copy link

@seemly seemly commented Jul 3, 2023

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

I have added a new `bv_run_acf_rule_tests_value` filter hook.

This means you can then pass a shortcode into the `Value` field in the UI, and run `do_shortcode` using the new filter prior to 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant