Prevents error when updating taxomy collections list if a taxonomy is removed.
This commit is contained in:
parent
aa7b442079
commit
c55e79cedc
|
@ -295,8 +295,11 @@ class Taxonomies extends Repository {
|
|||
$id = $taxonomy_id;
|
||||
if ( ! empty( $id ) && is_numeric( $id ) && is_numeric($collection_id) ) {
|
||||
$tax = $this->fetch( (int) $id );
|
||||
|
||||
if ( $tax instanceof Entities\Taxonomy ) {
|
||||
$tax->add_collection_id( $collection_id );
|
||||
if ( $tax->validate() ) {
|
||||
|
||||
if ( $tax->validate() )
|
||||
$this->insert( $tax );
|
||||
}
|
||||
}
|
||||
|
@ -307,8 +310,11 @@ class Taxonomies extends Repository {
|
|||
$id = $taxonomy_id;
|
||||
if ( ! empty( $id ) && is_numeric( $id ) && is_numeric($collection_id) ) {
|
||||
$tax = $this->fetch( (int) $id );
|
||||
|
||||
if ( $tax instanceof Entities\Taxonomy ) {
|
||||
$tax->remove_collection_id( $collection_id );
|
||||
if ( $tax->validate() ) {
|
||||
|
||||
if ( $tax->validate() )
|
||||
$this->insert( $tax );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue