PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 | inc/sitemaps/class-sitemaps-admin.php +12 -38 18.4.1 → trunk View file →
@@ -32,11 +32,13 @@
32 32 * Hooked into transition_post_status. Will initiate search engine pings
33 33 * if the post is being published, is a post type that a sitemap is built for
34 34 * and is a post that is included in sitemaps.
35 35 *
36 - * @param string $new_status New post status.
37 - * @param string $old_status Old post status.
38 - * @param \WP_Post $post Post object.
36 + * @param string $new_status New post status.
37 + * @param string $old_status Old post status.
38 + * @param WP_Post $post Post object.
39 + *
40 + * @return void
39 41 */
40 42 public function status_transition( $new_status, $old_status, $post ) {
41 43 if ( $new_status !== 'publish' ) {
42 44 return;
@@ -50,38 +52,8 @@
50 52
51 53 $post_type = get_post_type( $post );
52 54
53 55 wp_cache_delete( 'lastpostmodified:gmt:' . $post_type, 'timeinfo' ); // #17455.
54 -
55 - // Not something we're interested in.
56 - if ( $post_type === 'nav_menu_item' ) {
57 - return;
58 - }
59 -
60 - // If the post type is excluded in options, we can stop.
61 - if ( WPSEO_Options::get( 'noindex-' . $post_type, false ) ) {
62 - return;
63 - }
64 -
65 - if ( wp_get_environment_type() !== 'production' ) {
66 - return;
67 - }
68 -
69 - /**
70 - * Filter: 'wpseo_allow_xml_sitemap_ping' - Check if pinging is not allowed (allowed by default).
71 - *
72 - * @api boolean $allow_ping The boolean that is set to true by default.
73 - */
74 - if ( apply_filters( 'wpseo_allow_xml_sitemap_ping', true ) === false ) {
75 - return;
76 - }
77 -
78 - if ( defined( 'YOAST_SEO_PING_IMMEDIATELY' ) && YOAST_SEO_PING_IMMEDIATELY ) {
79 - WPSEO_Sitemaps::ping_search_engines();
80 - }
81 - elseif ( ! wp_next_scheduled( 'wpseo_ping_search_engines' ) ) {
82 - wp_schedule_single_event( ( time() + 300 ), 'wpseo_ping_search_engines' );
83 - }
84 56 }
85 57
86 58 /**
87 59 * While bulk importing, just save unique post_types.
@@ -88,11 +60,13 @@
88 60 *
89 61 * When importing is done, if we have a post_type that is saved in the sitemap
90 62 * try to ping the search engines.
91 63 *
92 - * @param string $new_status New post status.
93 - * @param string $old_status Old post status.
94 - * @param \WP_Post $post Post object.
64 + * @param string $new_status New post status.
65 + * @param string $old_status Old post status.
66 + * @param WP_Post $post Post object.
67 + *
68 + * @return void
95 69 */
96 70 private function status_transition_bulk( $new_status, $old_status, $post ) {
97 71 $this->importing_post_types[] = get_post_type( $post );
98 72 $this->importing_post_types = array_unique( $this->importing_post_types );
@@ -99,8 +73,10 @@
99 73 }
100 74
101 75 /**
102 76 * After import finished, walk through imported post_types and update info.
77 + *
78 + * @return void
103 79 */
104 80 public function status_transition_bulk_finished() {
105 81 if ( ! defined( 'WP_IMPORTING' ) ) {
106 82 return;
@@ -132,8 +108,6 @@
132 108
133 109 if ( WP_CACHE ) {
134 110 do_action( 'wpseo_hit_sitemap_index' );
135 111 }
136 -
137 - WPSEO_Sitemaps::ping_search_engines();
138 112 }
139 113 }