Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Allow guest to update custom post met using ajax

There are two hooks for adding AJAX handlers, you’re missing the one for non-logged in visitors. You need:

add_action( 'wp_ajax_nopriv_adClickCounter', 'adClickCounter_ajax' );

… in addition to the add_action call you currently have. Note the extra nopriv_ in the tag.

Related Posts:

  1. Long Polling: Stuck in while loop
  2. How to update Comment post meta through an Ajax call
  3. Update attachment metadata fails
  4. Attach time/date stamp on add_post_meta
  5. bulk update meta value with ajax
  6. Update status, meta while inside a post using AJAX button
  7. Filter images from media library by guid meta field
  8. Want to send ajax request in wordpress to a custom file in plugin
  9. delete post meta data in array WordPress
  10. Data from ajax not updating post meta
  11. delete attachment for one post without deleting actual attachment post
  12. add_post_meta not working within AJAX function
  13. PHP “php://input” vs $_POST
  14. Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
  15. Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
  16. Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
  17. How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
  18. Show spinner GIF during an $http request in AngularJS?
  19. Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
  20. JavaScript implementation of Gzip
  21. jQuery: Performing synchronous AJAX requests
  22. ASP.NET MVC controller actions that return JSON or partial html
  23. jQuery’s .on() method combined with the submit event
  24. Ajax takes 10x as long as it should/could
  25. How to check if I am in admin-ajax.php?
  26. Best way to end WordPress ajax request and why?
  27. How to load wp_editor() through AJAX/jQuery
  28. How to cache json with wp-super cache
  29. Load minimum WordPress environment
  30. Why use wp_send_json() over echo json_encode()?
  31. Why use admin-ajax.php and how does it work?
  32. How to get a unique nonce for each Ajax request?
  33. Open a Thickbox with content trough AJAX
  34. Initialize TinyMCE editor / visual editor after AJAX insert
  35. Why not register shortcodes if is_admin dashboard?
  36. WordPress AJAX with Axios
  37. Why is die() used at the end of function that handles an Ajax request?
  38. Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
  39. Making my AJAX powered WordPress Crawlable
  40. Is there a JavaScript API? How to access public and private data in JS?
  41. Get Previous & Next posts by Post ID
  42. failed to load wp-admin/admin-ajax.php
  43. Using Backbone with the WordPress AJAX API
  44. Using Ajax with a Class file
  45. Ajax in a settings page (update_option is undefined)
  46. How to pass data parameter to ajax action function handler
  47. WordPress Ajax Data Security
  48. post formats – how to switch meta boxes when changing format?
  49. Displaying PHP Errors from admin-ajax.php
  50. wp_set_auth_cookie() doesn’t work in Ajax call
  51. gettext does not translate when called in ajax
  52. Execute one AJAX request after another AJAX request finished
  53. WP-AJAX vs WP REST API: What to use for requests to the website from outside?
  54. Ajax and autocomplete
  55. How to add to cart via AJAX Woocommerce [closed]
  56. Nonces and Cache
  57. SSL breaks customizer: page isn’t returned from ajax
  58. Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
  59. Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
  60. How to HTML5 FormData Ajax
  61. admin-ajax.php vs Custom Page Template for Ajax Requests
  62. How to override WP_DEBUG for Ajax responses?
  63. Stop admin-ajax?
  64. redirect out of wp-admin, without losing admin-ajax.php
  65. Call to undefined function add_action()
  66. Is it safe to assume that a nonce may be validated more than once?
  67. Including WordPress in RESTful API
  68. Multiple ajax nonce requests
  69. Get posts with ajax
  70. admin-ajax.php doesn’t work when using POST data and Axios
  71. How to call a PHP function with Ajax when the user clicks a button
  72. REST API endpoint for elasticpress autosuggest
  73. Ajax for non-logged-in users
  74. Contact Form 7 Custom Post Action
  75. Custom Form with Ajax
  76. How to process ajax requests correctly using ajax plugins
  77. ajax – why multiple calls to wp_create_nonce() return same value?
  78. Update user meta using with ajax
  79. Registering AJAX callback function that is part of a class without instantiating the class in function.php
  80. WordPress function that makes HTML safe to be sent via AJAX request
  81. How do I hook an Ajax request into a PHP callback?
  82. AJAX request on the frontend always returns 0 if user is not admin
  83. admin-ajax.php returns 0. How do I debug it and fix it?
  84. Ajax requests without JQuery
  85. Admin Notification after save_post, when ajax saving in gutenberg
  86. How to properly use wp.ajax.post?
  87. Load tinyMCE / wp_editor() via AJAX [duplicate]
  88. How to tie built in AJAX to an add_action?
  89. Using Nonces for AJAX that only retrieves data
  90. WordPress AJAX Login Screen
  91. AJAX vs Fragment Caching for W3 Total Cache [closed]
  92. Saving (Updating) Post / Page Edits With AJAX
  93. Is there any way of of making an admin-ajax request without the use of die()?
  94. How to verify nonce from Bulk/Quick Edit in save_post?
  95. Using ajax on categories and wordpress loops
  96. Custom PHP endpoint for a plugin’s AJAX call
  97. Detecting post type within init action
  98. Ajax request returning full page code
  99. Basic question on passing variables to AJAX in WordPress
  100. Cannot load admin-ajax.php. No access-control allow origin*
Categories ajax Tags ajax, post-meta
WordPress update 4.4.1 redirect loop
What problems could happen if I replaced add_filter and add_action with the function calling

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress