PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
← All changes | includes/Core/Rest/Posts.php +9 -1 3.3.1 → 3.3.3 View file →
@@ -231,9 +231,17 @@
231 231 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
232 232 */
233 233 public function get_item($request) {
234 234 PostType::get_instance()->set_context( 'edit' );
235 - return PostType::get_instance()->get_post( absint( $request['id'] ) );
235 + $post = PostType::get_instance()->get_post( absint( $request['id'] ) );
236 + if ( empty( $post ) ) {
237 + return new WP_Error(
238 + 'rest_post_invalid_id',
239 + __( 'Invalid notification ID.', 'notificationx' ),
240 + array( 'status' => 404 )
241 + );
242 + }
243 + return $post;
236 244 }
237 245
238 246 /**
239 247 * Checks if a given request has access to create a post.