search for custom post on AJAX response in WORDPRESS
search for custom post on AJAX response in WORDPRESS I search for a post with certain $value in posts of custom post type with custom field in AJAX response. Custom field is provided by ACF plugin. When button is clicked then AJAX request is send and posts are searched through. If custom_field of a post equals $value then I get id of that post if $value doesn't exist in any of custom posts then post is created and I get id of newly created post. Every post of custom_post contains custom_field . When I refresh page it works and post is not created for second time after second click. Otherwise the another click doesn't find a post so it is created again. I don't know why refresh helps. $value custom_field $value id $value id custom_post custom_field In content-page.php I call a function from my functions.php that generates links with: content-page.php functions.php jQuery(document).ready(function($) { jQuery( "body" ).click(function( event ) { v...
