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

Where to hook my plugin’s action

Something important – when you create a new post the first thing WordPress does is an auto-save, so yes the first time the values should be empty. Perhaps that is what you are experiencing – I don’t see your full code, but I do see

The plugin for the custom meta data is hooked in the “save_post”
action.

Also, while editing WordPress also does an auto-save every 60 seconds by default. So perhaps check for auto-saves in your code, or you could try disabling auto-save completely.

function disable_autosave() {
    wp_deregister_script('autosave');
}
add_action('wp_print_scripts','disable_autosave');

Related Posts:

  1. Passing a parameter to filter and action functions
  2. Get a list of all registered actions
  3. How can I edit post data before it is saved?
  4. How can I see all the actions attached to an “add_action” hook?
  5. How to only hook on Single.php after content?
  6. When can you get current page ID and initialize hooks right after?
  7. How can I log a user out of WordPress before the page loads?
  8. What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
  9. WordPress admin notice in plugin function
  10. Using the ‘draft_to_publish’ hook (post status transition)
  11. Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
  12. Good tools for locating hooks in a wordpress page/admin interface/blog post?
  13. Use external link in the add sub menu
  14. How can I add a custom meta value on file upload?
  15. do_action and hook methods
  16. Is it possible to add an action to the currently running action?
  17. How to filter content post only on save
  18. Filter or action hook to insert content on admin pages before tag
  19. Is it possible to remove this action? (as it’s added just before it’s called)
  20. WordPress Plugin Boilerplate – add_action hook in static “activate” function
  21. How to prevent action in ajax request, when in admin side?
  22. template_redirect not being called when using ajax
  23. Can I use a method from an existing plugin as an action hook?
  24. Plugin custom Action Hook not working
  25. What are the benefit in adding hook in the init() hook?
  26. add_action in functions.php, do_action in plugin?
  27. add action for displaying posts using a shortcode
  28. ‘wp_login’ action hook not working with wp-login.php file
  29. How do action and filter hooks understand where to look for the core function that we hooked our function to them
  30. WordPress filter that hook after each action/filter hook
  31. When to use action hooks and plugins
  32. Any hook for pre-plugin-update -either bulk or single plugin update
  33. Insert new user with form submit ‘init’ hook
  34. How to get all of the activate_plugin action parameters?
  35. Calling plugin function inside custom plugin for onclick event
  36. get current date + 90 days and checking every day
  37. Get Time Taken By Each Action Hook in WordPress
  38. Are functions in main plugin file called before function bound to register_activation_hook runs?
  39. How can I change the meta_key for a particular piece of information?
  40. How to get post ID with hooks publish_post, new_to_publish, etc
  41. edit_user_profile and show_user_profile are not firing inside a class
  42. the_post hook is not firing for me
  43. Why do plugins often ask to add in to templates?
  44. Create a post builder skin in a plugin
  45. remove_action not removing add_action from constructor
  46. Plugin Development – Functions or Hooks?
  47. How to get menu location in wp_update_nav_menu hook
  48. How do I add some javascript validation to the admin interface form’s onsubmit?
  49. Hook for page Request?
  50. Are there action hooks for comments?
  51. WooCommerce: after install hook
  52. How to remove a class function from a plugin by using remove_action()?
  53. Advanced WordPress plugin activation detection
  54. Add action to custom Function
  55. What hook can I use to modify custom post data before it is displayed on the page?
  56. How to hook into action/filter call
  57. Why does “updated_post_meta” did not fire when uploading media other than image?
  58. Hook from plugin doesn’t fire up from external PHP script
  59. update_option_{$option} not working (do function after options are saved)
  60. Callback hooked to post_updated firing on new posts as well
  61. The function called on the wp head hook becomes null
  62. How to securely controlling data without keeping it in postmeta?
  63. Hooking into the HTML header container
  64. Use action, filter, or hook to append HTML to WordPress plugin function
  65. Passing function into add_action always returns the first argument
  66. {status}_{post_type} does not run correctly?
  67. Why can’t I shove an instance of a class into a variable from a do_action hook?
  68. wp_login_form() ignoring login_form action hook
  69. Passing a parameter to filter and action functions
  70. Run only on plug-in activation instead of wp_head
  71. Plugin Hook: Get posts
  72. change output location of plugin function using a custom hook
  73. OOP Plugin: Where should I place the action hooks in the class?
  74. add query string to all pages after user logged in
  75. How wordpress plugin hooks works? [duplicate]
  76. User register hook can’t access form request
  77. Hook automatic_updates_complete to autoupdate plugin
  78. WordPress Action Hook inside Classes
  79. Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
  80. Remove 3rd party plugin notices from within own plugin
  81. Hook (or other way) to find out when another plugin is activated / installed
  82. Doubt using $wpbd->get_col for a single column
  83. Is there an earlier hook than login_head or login_enqueue_scripts?
  84. Add custom message to the plugins page of WordPress
  85. Gravity Forms plugin: How to use “gform_editor_js” action hook? [closed]
  86. Access WordPress database outside of WordPress
  87. How to create custom tables in WordPress using my own plugin?
  88. wordpress plugin is not activating from widget
  89. Inserting above the comment template
  90. Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms? [closed]
  91. How to access data in wordpress database externally using php
  92. Is it possible to create Custom Post plug-in?
  93. How do I display only the latest post on my home page, while maintaining proper plugin hooks?
  94. WordPress Settings Lost After Site Migration
  95. Help With MySQL to WPDB Query Conversion
  96. When to load auto-login code?
  97. What is generating my meta og:description?
  98. Hooking in to replace the Sidebar/Widget areas
  99. custom user tables supported in SharDB plugin?
  100. Modifying the comments section through a plugin regardless of theme
Categories plugins Tags actions, database, hooks, plugins, post-meta
way to include own functions independent of theme
Batch update menu_order attribute alphabetically

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