diff --git a/app/Http/Controllers/TablesController.php b/app/Http/Controllers/TablesController.php index dc16623..399e827 100644 --- a/app/Http/Controllers/TablesController.php +++ b/app/Http/Controllers/TablesController.php @@ -120,6 +120,12 @@ public function duplicate(Request $request, $id) $post = get_post($oldPostId); + if (!$post || $post->post_type !== $this->cptName) { + $this->json(array( + 'message' => __('Table not found.', 'ninja-tables') + ), 404); + } + // Duplicate table itself. $attributes = array( 'post_title' => $post->post_title . '( Duplicate )',