Home › Forums › General Issues › Search post for ACF value via form input › Reply To: Search post for ACF value via form input
The simplest method is to create a form that has a field with a name that does not conflict with any WP reserved words
<form ....>
<input name="post_passcode" .....>
</form>
This is just the basics, of course you should also add a nonce field as well as sanitizing the input.
add_action('init', 'test_form_passcode');
function test_form_passcode() {
if (!isset($_POST['post_passcode'])) {
return;
}
// sanitize
// WP_Query
// If results, loop, get post permalink
wp_redirect($post_permalink);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.