How to avoid infinite loop in save_post callback

You can remove the callback from the save_post hook, update the post and then re-add the call back to the hook. The Codex gives an example. add_action(‘save_post’, ‘wpse51363_save_post’); function wpse51363_save_post($post_id) { //Check it’s not an auto save routine if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; //Perform permission checks! For example: if ( !current_user_can(‘edit_post’, $post_id) ) … Read more

Check for update vs new post on save_post action

Since WordPress version 3.7. – IIRC – the save_post hook – more information about the hook and its usage at Code Reference: save_post and Codex: save_post – has a third parameter $update which can be used to determine just that. @param     int               $post_ID     Post ID. @param     WP_Post     $post          Post object. @param … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)