acf backend error handling

Lets walk though the acf/validate_value filter logically… I’m assuming both of your code snippets are the same snippet, and you are not executing them together (as @Buttered_Toast pointed out). Here is your code (see my added comments) code below is assuming your dfg_service_type acf field is a number field… /** * @param mixed $valid Whether … Read more

Can I use WP blocks in a template?

2 methods do_blocks, takes block content as a string, parses them, renders each block, then returns the final rendered content. This is the same content in post_content, aka the HTML comment and the HTML tags inside it e.g. something similar to this: echo do_blocks( ‘<!– wp:paragraph –><p>Hello world.</p><!– /wp:paragraph –>’); Use a block template part … Read more

ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)

This isn’t possible using WP_Query, you can’t query the insides of structured data stored in a single post meta value. At best you can use regular expressions, or do math/boolean comparisons, you can even do LIKE comparisons, but these are all string operations. If you need to query structured data such as objects or arrays, … Read more