Created
July 2, 2022 07:41
-
-
Save miznokruge/679eb03c0d45c259d0286a9374e9085d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(__FILE__) . '/wp-config.php'); | |
$wp->init(); | |
$wp->parse_request(); | |
$wp->query_posts(); | |
$wp->register_globals(); | |
$wp->send_headers(); | |
// Your WordPress functions here... | |
///echo site_url(); | |
$komen = []; | |
$comments = get_comments(); | |
foreach ($comments as $c) { | |
if ($c->comment_author_email != '') { | |
$komen[] = [ | |
'id' => $c->comment_ID, | |
'name' => $c->comment_author, | |
'email' => $c->comment_author_email, | |
'date' => $c->comment_date, | |
'content' => strip_tags($c->comment_content), | |
'post_title' => get_the_title($c->comment_post_ID), | |
'post_url' => get_permalink($c->comment_post_ID) | |
]; | |
$kf = array($c); | |
} | |
} | |
$data['site_url'] = site_url(); | |
$data['comments'] = $komen; | |
header("Content-Type:Application/json"); | |
echo json_encode($data); | |
die; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment