Fix some story comments issues

This commit is contained in:
Tetrakern 2023-08-25 23:57:24 +02:00
parent 682e08fc40
commit 0aae80988c
2 changed files with 5 additions and 1 deletions

View File

@ -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';

View File

@ -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