wp_count_posts

wp_count_posts

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('wp_count_posts') is found 2 times:

  • /wp-includes/post.php line 3325
    3321
    3322
    3323
    3324
    3325
    3326
    3327
    3328
    3329
    3330
    3331
            }
        }
     
        /** This filter is documented in wp-includes/post.php */
        return apply_filters( 'wp_count_posts', $counts, $type, $perm );
    }
     
    $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
     
    if ( 'readable' === $perm && is_user_logged_in() ) {
        $post_type_object = get_post_type_object( $type );
  • /wp-includes/post.php line 3363
    3359
    3360
    3361
    3362
    3363
    3364
    3365
    3366
    3367
    3368
    3369
         * @param string   $type   Post type.
         * @param string   $perm   The permission to determine if the posts are 'readable'
         *                         by the current user.
         */
        return apply_filters( 'wp_count_posts', $counts, $type, $perm );
    }
     
    /**
     * Counts number of attachments for the mime type(s).
     *
     * If you set the optional mime_type parameter, then an array will still be

See this hook used in plugins: