fix: order of update taxonomy metadatum

This commit is contained in:
vnmedeiros 2023-11-12 14:51:06 -03:00
parent b4252e90c3
commit 1b462d8173
2 changed files with 3 additions and 5 deletions

View File

@ -737,8 +737,8 @@ class Metadata extends Repository {
public function insert( $metadatum ) { public function insert( $metadatum ) {
$this->pre_update_taxonomy_metadatum( $metadatum ); $this->pre_update_taxonomy_metadatum( $metadatum );
$new_metadatum = parent::insert( $metadatum ); $new_metadatum = parent::insert( $metadatum );
$this->update_taxonomy_metadatum( $new_metadatum );
$this->update_metadata_type_index( $new_metadatum ); $this->update_metadata_type_index( $new_metadatum );
$this->update_taxonomy_metadatum( $new_metadatum );
return $new_metadatum; return $new_metadatum;
} }

View File

@ -346,7 +346,7 @@ class Taxonomies extends Repository {
return; return;
} }
$query = $wpdb->prepare(" $taxonomies_res = $wpdb->get_results("
SELECT SELECT
meta.post_id as meta_id, meta.meta_value as tax_id, col.meta_value as collection_id meta.post_id as meta_id, meta.meta_value as tax_id, col.meta_value as collection_id
FROM FROM
@ -356,9 +356,7 @@ class Taxonomies extends Repository {
WHERE WHERE
meta.meta_key='_option_taxonomy_id' meta.meta_key='_option_taxonomy_id'
AND meta.post_id IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_key='metadata_type' and meta_value='Tainacan\\\Metadata_Types\\\Taxonomy'); AND meta.post_id IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_key='metadata_type' and meta_value='Tainacan\\\Metadata_Types\\\Taxonomy');
", []); ");
$taxonomies_res = $wpdb->get_results( $query );
foreach ($taxonomies_res as $tax_res) { foreach ($taxonomies_res as $tax_res) {
// Aqui você pode acessar os valores de cada coluna // Aqui você pode acessar os valores de cada coluna