Inpsyde\MultilingualPress\Widget\Dashboard\UntranslatedPosts\PostRepository::update_post PHP Метод

update_post() публичный Метод

Updates the translation complete setting value for the post with the given ID.
С версии: 3.0.0
public update_post ( integer $post_id, boolean $value ) : boolean
$post_id integer Post ID.
$value boolean Setting value to be set.
Результат boolean Whether or not the translation complete setting value was updated successfully.
    public function update_post($post_id, $value);

Usage Example

 /**
  * Updates the translation completed setting of the post with the given ID.
  *
  * @since   3.0.0
  * @wp-hook save_post
  *
  * @param int     $post_id Post ID.
  * @param WP_Post $post    Post object.
  *
  * @return bool Whether or not the translation completed setting was updated successfully.
  */
 public function update_setting($post_id, WP_Post $post)
 {
     if (!$this->nonce->is_valid()) {
         return false;
     }
     if (!in_array($post->post_status, ['publish', 'draft'], true)) {
         return false;
     }
     $value = array_key_exists(PostRepository::META_KEY, $_POST) ? (bool) $_POST[PostRepository::META_KEY] : false;
     return $this->post_repository->update_post($post_id, $value);
 }