mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
When deleting a term, delete its metadata as well.
Props barryceelen. Fixes #34626. git-svn-id: https://develop.svn.wordpress.org/trunk@35585 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -381,6 +381,24 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
$this->assertSame( 'ambiguous_term_id', $found->get_error_code() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 34626
|
||||
*/
|
||||
public function test_term_meta_should_be_deleted_when_term_is_deleted() {
|
||||
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
add_term_meta( $t, 'foo', 'bar' );
|
||||
add_term_meta( $t, 'foo1', 'bar' );
|
||||
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo1', true ) );
|
||||
|
||||
$this->assertTrue( wp_delete_term( $t, 'wptests_tax' ) );
|
||||
|
||||
$this->assertSame( '', get_term_meta( $t, 'foo', true ) );
|
||||
$this->assertSame( '', get_term_meta( $t, 'foo1', true ) );
|
||||
}
|
||||
|
||||
public static function set_cache_results( $q ) {
|
||||
$q->set( 'cache_results', true );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user