From 0aae80988cd483189c7732d31ea5f57f7cb15fe9 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Fri, 25 Aug 2023 23:57:24 +0200 Subject: [PATCH] Fix some story comments issues --- functions.php | 4 ++++ includes/functions/comments/_story_comments.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 6f1adbed..b6879a80 100644 --- a/functions.php +++ b/functions.php @@ -635,6 +635,10 @@ require_once __DIR__ . '/includes/functions/_oauth.php'; require_once __DIR__ . '/includes/functions/comments/_comments_controller.php'; // Used in REST require_once __DIR__ . '/includes/functions/comments/_story_comments.php'; // Used in REST +if ( strpos( $_SERVER['REQUEST_URI'], 'wp-json/fictioneer/' ) !== false ) { + require_once __DIR__ . '/includes/functions/comments/_comments_threads.php'; +} + if ( is_admin() ) { // Required for AJAX require_once __DIR__ . '/includes/functions/comments/_comments_ajax.php'; diff --git a/includes/functions/comments/_story_comments.php b/includes/functions/comments/_story_comments.php index 96fa5cde..bd853c03 100644 --- a/includes/functions/comments/_story_comments.php +++ b/includes/functions/comments/_story_comments.php @@ -147,7 +147,7 @@ add_action( 'rest_api_init', 'fictioneer_register_endpoint_get_story_comments' ) function fictioneer_rest_get_story_comments( WP_REST_Request $request ) { // Validations $story_id = $request->get_param( 'post_id' ); - $story_id = isset( $story_id ) ? fictioneer_validate_id( $_GET['post_id'], 'fcn_story' ) : false; + $story_id = isset( $story_id ) ? fictioneer_validate_id( $story_id, 'fcn_story' ) : false; $default_error = array( 'error' => __( 'Comments could not be loaded.', 'fictioneer' ) ); // Abort if not a story