| @@ -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,20 @@ | ||
| 50 | 52 | |
| 51 | 53 | $post_type = get_post_type( $post ); |
| 52 | 54 | |
| 53 | 55 | wp_cache_delete( 'lastpostmodified:gmt:' . $post_type, 'timeinfo' ); // #17455. |
| 56 | + } | |
| 54 | 57 | |
| 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 | - } | |
| 58 | + /** | |
| 59 | + * Notify Google of the updated sitemap. | |
| 60 | + * | |
| 61 | + * @deprecated 22.0 | |
| 62 | + * @codeCoverageIgnore | |
| 63 | + * | |
| 64 | + * @return void | |
| 65 | + */ | |
| 66 | + public function ping_search_engines() { | |
| 67 | + _deprecated_function( __METHOD__, 'Yoast SEO 22.0' ); | |
| 84 | 68 | } |
| 85 | 69 | |
| 86 | 70 | /** |
| 87 | 71 | * While bulk importing, just save unique post_types. |
| @@ -88,11 +72,13 @@ | ||
| 88 | 72 | * |
| 89 | 73 | * When importing is done, if we have a post_type that is saved in the sitemap |
| 90 | 74 | * try to ping the search engines. |
| 91 | 75 | * |
| 92 | - * @param string $new_status New post status. | |
| 93 | - * @param string $old_status Old post status. | |
| 94 | - * @param \WP_Post $post Post object. | |
| 76 | + * @param string $new_status New post status. | |
| 77 | + * @param string $old_status Old post status. | |
| 78 | + * @param WP_Post $post Post object. | |
| 79 | + * | |
| 80 | + * @return void | |
| 95 | 81 | */ |
| 96 | 82 | private function status_transition_bulk( $new_status, $old_status, $post ) { |
| 97 | 83 | $this->importing_post_types[] = get_post_type( $post ); |
| 98 | 84 | $this->importing_post_types = array_unique( $this->importing_post_types ); |
| @@ -99,8 +85,10 @@ | ||
| 99 | 85 | } |
| 100 | 86 | |
| 101 | 87 | /** |
| 102 | 88 | * After import finished, walk through imported post_types and update info. |
| 89 | + * | |
| 90 | + * @return void | |
| 103 | 91 | */ |
| 104 | 92 | public function status_transition_bulk_finished() { |
| 105 | 93 | if ( ! defined( 'WP_IMPORTING' ) ) { |
| 106 | 94 | return; |
| @@ -132,8 +120,6 @@ | ||
| 132 | 120 | |
| 133 | 121 | if ( WP_CACHE ) { |
| 134 | 122 | do_action( 'wpseo_hit_sitemap_index' ); |
| 135 | 123 | } |
| 136 | - | |
| 137 | - WPSEO_Sitemaps::ping_search_engines(); | |
| 138 | 124 | } |
| 139 | 125 | } |