• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Wordpress

Wordpress World

  • Submit
  • Disclaimers
  • About
  • DMCA
  • Privacy Policy
  • Contact

You are here: Home / Hook after all metadata are set is triggering several time

Hook after all metadata are set is triggering several time

August 16, 2019 by

I need to trigger a function everytime the user save the post manually (so only thanks to the “Update button”).

Here’s what I have :

add_action( 'save_post', 'my_save_post_function', 10, 3 ); function my_save_post_function($object_id, $post, $updated)  { $post = get_post($object_id); $post_ID = $object_id; if(!wp_doing_ajax() && count($_REQUEST) > 2){ if($post->post_type == "incsub_event" && $_POST["action"] = "editpost") { /* do stuff*/ } } 

Problem : this function is trigger twice (I can see that thanks to my code in do stuff, everything is dupplicated).

Seems like the first time is triggered when the user click on the link, and the second time (maybe ?) after the metadata are updated.

How can I trigger this only once ?

PS : tried with hook “post_updated” (doesn’t update my metadata) and “update_post_metadata” (triggers twice too)


  • State NFL roundup: Philip Rivers sets all-time NFL accuracy mark
  • Montana State's Tyler Hall sets all-time scoring record
  • Boston sets all-time temperature record for Dec. 21
  • Thanksgiving 2018: Air travel could set all-time record for the holiday
  • Sabrina Ionescu sets all-time Div. I triple-double record as Oregon beats Air Force 82-36
  • Panthers capture Bahamas Bowl, set all-time win record
  • Trump sets prime time address Tuesday to pitch border wall, and border visit Thursday
  • Triggering a Time Trap
  • Trigger Warning is a Paranoid Right-Wing Laugh Riot
  • Remembering Sandy Hook on its 6th year anniversary, vigil to be held Friday

Filed Under: Tags initial and final setting time of cement, hook from once upon a time, hook once upon a time, setting fitbit time, clavicle hook plate removal recovery time, best settings for time lapse, hook in once upon a time, moonrise set times, setting up time capsule, corridors of time chrono trigger, set net time, how to set time on g shock analog, timex wr100m set time, ny times sets, ultra 2018 set times, trigger time, tikka set trigger, g shock 5146 set time, how to set ihome time, set engine timing, rolex time setting, gopro time lapse settings, setting priorities time management, trigger finger injection recovery time, why time does the sun set, about time where is it set

Primary Sidebar

RSS Recent Stories

  • Remove unwanted elements for a wp_nav_menu
  • Get_term_meta() always returns false
  • How to ask WordPress to generate XHTML?
  • Get user count based on multiple meta key values?
  • 21 Best Coffee Shop Themes for WordPress (2019)
Copyright © 2019 Wordpress. Power by Wordpress.