Changeset 35585
- Timestamp:
- 11/09/2015 03:35:56 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/wp-includes/meta-functions.php (modified) (2 diffs)
-
src/wp-includes/taxonomy-functions.php (modified) (2 diffs)
-
tests/phpunit/tests/term/meta.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/meta-functions.php
r35170 r35585 559 559 * @global wpdb $wpdb WordPress database abstraction object. 560 560 * 561 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)561 * @param string $meta_type Type of object metadata is for (e.g., comment, post, meta, or user). 562 562 * @param int $meta_id ID for a specific meta row 563 563 * @return object|false Meta object or false. … … 693 693 * @global wpdb $wpdb WordPress database abstraction object. 694 694 * 695 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)695 * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user). 696 696 * @param int $meta_id ID for a specific meta row 697 697 * @return bool True on successful delete, false on failure. -
trunk/src/wp-includes/taxonomy-functions.php
r35537 r35585 2055 2055 * that term's parent. 2056 2056 * 2057 * Metadata associated with the term will be deleted. 2058 * 2057 2059 * The `$args` 'default' will only override the terms found, if there is only one 2058 2060 * term found. Any other and the found terms are used. … … 2172 2174 foreach ( $tax_object->object_type as $object_type ) 2173 2175 clean_object_term_cache( $objects, $object_type ); 2176 2177 $term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) ); 2178 foreach ( $term_meta_ids as $mid ) { 2179 delete_metadata_by_mid( 'term', $mid ); 2180 } 2174 2181 2175 2182 /** -
trunk/tests/phpunit/tests/term/meta.php
r35515 r35585 382 382 } 383 383 384 /** 385 * @ticket 34626 386 */ 387 public function test_term_meta_should_be_deleted_when_term_is_deleted() { 388 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 389 390 add_term_meta( $t, 'foo', 'bar' ); 391 add_term_meta( $t, 'foo1', 'bar' ); 392 393 $this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) ); 394 $this->assertSame( 'bar', get_term_meta( $t, 'foo1', true ) ); 395 396 $this->assertTrue( wp_delete_term( $t, 'wptests_tax' ) ); 397 398 $this->assertSame( '', get_term_meta( $t, 'foo', true ) ); 399 $this->assertSame( '', get_term_meta( $t, 'foo1', true ) ); 400 } 401 384 402 public static function set_cache_results( $q ) { 385 403 $q->set( 'cache_results', true );
Note: See TracChangeset
for help on using the changeset viewer.