You appear to be a bot. Output may be restricted
Description
Usage
Tests_Admin_Includes_Post::test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/admin/includesPost.php
Lines:
1 to 37 of 37
public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() { wp_set_current_user( self::$editor_id ); register_taxonomy( 'wptests_tax', array( 'post' ) ); $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'foo', 'slug' => 'bar', ) ); $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'bar', 'slug' => 'foo', ) ); $post_data = array( 'post_ID' => self::$post_id, 'tax_input' => array( 'wptests_tax' => 'foo,baz', ), ); edit_post( $post_data ); $found = wp_get_post_terms( self::$post_id, 'wptests_tax' ); // Should contain the term with the name 'foo', not the slug. $this->assertContains( $t1, wp_list_pluck( $found, 'term_id' ) ); // The 'baz' tag should have been created. $this->assertContains( 'baz', wp_list_pluck( $found, 'name' ) ); }