using custom template for in house reporting setup. Still using 4x. Looking at 5-Pro but “almost done” with existing project which got delayed from last year.
Need help or advice on how to output a text field with HTML encoding to drop in the %20 for blank spaces from something like a book title, perhaps using esc_attr somehow?
So, if we have a book title like This Great Book Title
in a normal text field.
e.g., <php the_field('s2p_release_title');>
normal usage might be <a href="http://searchable.zzz/s?q=<?php the_field('s2p_release_title'); ?>&window=realtime&sort=date" target="_blank" rel="nofollow" class="btn btn-primary" role="button">Click for Report</a>
Problem is for the search to work
it breaks with ?q=This Great Book Title
when it needs to print on page in template as ?q=This%20Great%20Book%20Title
I found this solution, but it seems like a lot of natter when presumably the esc_attr or similar built-in to WP might be able to do it? http://snippets.khromov.se/sanitizing-and-securing-advanced-custom-fields-output/
For example something like this, but this is obviously wrong?