Yoast\WP\SEO\Content_Type_Visibility\Application
Content_Type_Visibility_Dismiss_Notifications::post_type_dismiss
Removes New badge from a post type in the Settings, remove notifications if needed.
Метод класса: Content_Type_Visibility_Dismiss_Notifications{}
Хуков нет.
Возвращает
Массив
. The response.
Использование
$Content_Type_Visibility_Dismiss_Notifications = new Content_Type_Visibility_Dismiss_Notifications(); $Content_Type_Visibility_Dismiss_Notifications->post_type_dismiss( $post_type_name );
- $post_type_name(строка) (обязательный)
- The post type name from the request.
Код Content_Type_Visibility_Dismiss_Notifications::post_type_dismiss() Content Type Visibility Dismiss Notifications::post type dismiss Yoast 25.3.1
public function post_type_dismiss( $post_type_name ) { $success = true; $message = \__( 'Post type is not new.', 'wordpress-seo' ); $post_types_needs_review = $this->options->get( 'new_post_types', [] ); if ( $post_types_needs_review && \in_array( $post_type_name, $post_types_needs_review, true ) ) { $new_needs_review = \array_diff( $post_types_needs_review, [ $post_type_name ] ); $success = $this->options->set( 'new_post_types', $new_needs_review ); $message = ( $success ) ? \__( 'Post type is no longer new.', 'wordpress-seo' ) : \__( 'Error: Post type was not removed from new_post_types list.', 'wordpress-seo' ); if ( $success ) { $this->maybe_dismiss_notifications( [ 'new_post_types' => $new_needs_review ] ); } } $status = ( $success ) ? 200 : 400; return [ 'message' => $message, 'success' => $success, 'status' => $status, ]; }