You appear to be a bot. Output may be restricted
Description
Usage
Tests_Post::test_wp_count_posts_filtered();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/post.php
Lines:
1 to 20 of 20
function test_wp_count_posts_filtered() { $post_type = rand_str( 20 ); register_post_type( $post_type ); self::factory()->post->create_many( 3, array( 'post_type' => $post_type, 'post_author' => self::$editor_id, ) ); $count1 = wp_count_posts( $post_type, 'readable' ); $this->assertEquals( 3, $count1->publish ); add_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) ); $count2 = wp_count_posts( $post_type, 'readable' ); $this->assertEquals( 2, $count2->publish ); remove_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) ); }