/** * Inserta el la accion como un nuevo post en la base de datos. * @return int|\WP_Error el id del post nuevo insertado. */ public function InsertAsNew() { \MagicFieldsUtil::PrepareMagicFieldsToSave(UsuarioAccion::PostTypeName, $this->MagicFieldsStructureOfValues()); return $this->DoSetDirty(); }
/** * Inserta el la accion como un nuevo post en la base de datos. * @return int|\WP_Error el id del post nuevo insertado. */ public function InsertAsNew() { \MagicFieldsUtil::PrepareMagicFieldsToSave(Accion::PostTypeName, $this->MagicFieldsStructureOfValues()); // Create post object $newPostArgs = array('post_type' => Accion::PostTypeName, 'post_title' => wp_strip_all_tags($this->titulo), 'post_name' => $this->titulo, 'post_excerpt' => $this->excerpt, 'post_content' => "", 'post_status' => 'draft'); $newPostId = wp_insert_post($newPostArgs); // Set the taxonomies. wp_set_object_terms($newPostId, $this->QueTeGustariaHacerTermIds(), "que_te_gustaria_hacer"); wp_set_object_terms($newPostId, $this->CuantoTiempoTienesTermIds(), "cuanto_tiempo_tienes"); wp_set_object_terms($newPostId, $this->QueTeMueveTermIds(), "que_te_mueve"); return $newPostId; }