wp ajax return 0

There’s a simple alternative that sidesteps this issue entirely with a modern and easy to use interface, just use a REST API endpoint!

So lets turn this:

add_action('wp_ajax_nopriv_linked_post_image_grid', 'linked_post_image_grid');
add_action('wp_ajax_linked_post_image_grid', 'linked_post_image_grid');

function linked_post_image_grid(){

    echo 'this is return message';

    die();
}

Into this:

add_action( 'rest_api_init', function () {
        register_rest_route( 'buxbeatz/v1', '/linked_post_image_grid/', array(
                'methods' => 'GET',
                'callback' => 'linked_post_image_grid'
        ) );
} );

function linked_post_image_grid( $request ) {
    return "this is return message";
}

Now you can visit example.com/wp-json/buxbeatz/v1/linked_post_image_grid and you’ll get a JSON response of "this is return image"