public function run($new_status, $old_status, $post) { // verify this is not an auto save routine. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // Only count on post type 'post' if ('post' != $post->post_type) { return; } // Post status must be publish if ('publish' != $new_status) { return; } // Save Words $related_word_manager = new RP4WP_Related_Word_Manager(); $related_word_manager->save_words_of_post($post->ID); }
public function run($new_status, $old_status, $post) { // verify this is not an auto save routine. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // Post status must be publish if ('publish' != $new_status) { return; } // Check if this post type is installed $pt_manager = new RP4WP_Post_Type_Manager(); if (!$pt_manager->is_post_type_installed($post->post_type)) { return; } // Save Words $related_word_manager = new RP4WP_Related_Word_Manager(); $related_word_manager->save_words_of_post($post->ID, $post->post_type); }
public function run($post_id, $post) { // verify this is not an auto save routine. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // Only count on post type 'post' if ('post' != $post->post_type) { return; } // Check permission if (!current_user_can('edit_post', $post_id)) { return; } // Post status must be publish if ('publish' != $post->post_status) { return; } // Save Words $related_word_manager = new RP4WP_Related_Word_Manager(); $related_word_manager->save_words_of_post($post_id); }