Changeset 48497
- Timestamp:
- 07/16/2020 09:42:48 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r48480 r48497 2648 2648 $counts = wp_cache_get( $cache_key, 'counts' ); 2649 2649 if ( false !== $counts ) { 2650 // We may have cached this before every status was registered. 2651 foreach ( get_post_stati() as $status ) { 2652 if ( ! isset( $counts->{$status} ) ) { 2653 $counts->{$status} = 0; 2654 } 2655 } 2656 2650 2657 /** This filter is documented in wp-includes/post.php */ 2651 2658 return apply_filters( 'wp_count_posts', $counts, $type, $perm ); -
trunk/tests/phpunit/tests/post.php
r47431 r48497 881 881 882 882 /** 883 * @ticket 49685 884 */ 885 function test_wp_count_posts_status_changes_visible() { 886 self::factory()->post->create_many( 3 ); 887 888 // Trigger a cache. 889 wp_count_posts(); 890 891 register_post_status( 'test' ); 892 893 $counts = wp_count_posts(); 894 $this->assertTrue( isset( $counts->test ) ); 895 $this->assertEquals( 0, $counts->test ); 896 } 897 898 /** 883 899 * @ticket 13771 884 900 */
Note: See TracChangeset
for help on using the changeset viewer.