Passing a value from an input field to a php function in WordPress?

If you add handler for action with add_action, you should call this with do_action, but I does not see it. Also actions using in AJAX, simple POST/GET request is not need of Simple example of form handling <form method=”POST” action=”” class=”my-form”> <input type=”hidden” name=”category” value=”” /> <input type=”hidden” name=”action” value=”recipe_filter” value=”123″ /> <input type=”submit” /> … Read more

How to use wp_ajax_set_post_thumbnail?

Assuming you’re looking at calling this via an AJAX style call from your browser, I’d suggest you look at the new WordPress REST API. Here’s the docs for the endpoint for updating posts. This will allow you to do exactly the same thing with the featured_media parameter, and much more, and is likely much better … Read more

Check $post->ID against multiple values

This is more of a PHP question than specifically WordPress, but you can use PHP’s in_array to test if $post->ID is in a bunch of values, like this: <?php if( in_array($post->ID, [13052, 1234, 4242]) ) { ?> <!– Event snippet for thank-you page –><script> gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-105871269/5v9gsts6dbdsJ-Kl’});</script> <?php } ?>