PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | admin/tracking/class-tracking-default-data.php +17 -0 18.628.5 View file →
@@ -26,9 +26,26 @@
26 26 'siteLanguage' => get_bloginfo( 'language' ),
27 27 'gmt_offset' => get_option( 'gmt_offset' ),
28 28 'timezoneString' => get_option( 'timezone_string' ),
29 29 'migrationStatus' => get_option( 'yoast_migrations_free' ),
30 + 'countPosts' => $this->get_post_count( 'post' ),
31 + 'countPages' => $this->get_post_count( 'page' ),
30 32 ];
33 + }
34 +
35 + /**
36 + * Returns the number of posts of a certain type.
37 + *
38 + * @param string $post_type The post type return the count for.
39 + *
40 + * @return int The count for this post type.
41 + */
42 + protected function get_post_count( $post_type ) {
43 + $count = wp_count_posts( $post_type );
44 + if ( isset( $count->publish ) ) {
45 + return $count->publish;
46 + }
47 + return 0;
31 48 }
32 49
33 50 /**
34 51 * Returns the WordPress version.