Created
January 30, 2020 05:06
-
-
Save manchumahara/35e846858fca18424c2b55e20878ea90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//save_topic_meta_boxes method is hooked from 'save_post' | |
//this just code sample from my code | |
/** | |
* Save topic meta boxes | |
* | |
* @param $topic_id | |
* | |
* @return mixed | |
*/ | |
public function save_topic_meta_boxes( $topic_id ) { | |
//If calling wp_update_post, unhook this function so it doesn't loop infinitely | |
remove_action( 'save_post', array( $this, 'save_topic_meta_boxes' ) ); | |
/// ...।now write code needed for wp_insert_post or wp_update_post | |
then again attach the hook again | |
// re-hook this function | |
add_action( 'save_post', array( $this, 'save_topic_meta_boxes' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment