In a project, I have to show wp posts in website via .net. So, I created a php file in project root folder as ‘latestnews.php’. When called from browser, everything is working fine and data is shown. But in postman though the data is shown status is coming as 404 not found.

How to solve this issue? Any help/suggestions are welcome. Url:


define('WP_USE_THEMES', false);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

$num = $_GET["numberposts"] ?: '10';

$posts = get_posts(array(
    'posts_per_page'   => $num,
$array = array();

foreach($posts as $val) {
    $array[] = array(
            'id' => $val->ID,
            'title' => $val->post_title,
            'link' => get_permalink($val->ID),
            'publish_date' => $val->post_date,
            'content' => strip_tags($val->post_content),
            'image' => get_the_post_thumbnail_url($val->ID, 'full')
echo json_encode($array);

Read more here: postman chrome shows 404 error on calling of wordpress url from .net


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: