I have a WordPress site and I'm trying to fetch a specific post by its ID. Currently, the content is being displayed successfully, but it's also showing HTML tags in the main output. Here is an example:
https://i.stack.imgur.com/f3pdq.png
Code using Vue JS:
<template lang="">
<div>
<h1>Single Post Page</h1>
<div v-if="postLoaded">
{{ post.content.rendered }}
</div>
<p v-else>
Please wait ...
</p>
</div>
</template>
<script>
import axios from 'axios';
export default {
data() {
return {
postLoaded : false,
post : null,
}
},
mounted() {
let postId = this.$route.params.id;
axios.get('https://amarcourse.com/wp-json/wp/v2/posts/' + postId )
.then((response) => {
this.post = response.data;
this.postLoaded = true;
})
.catch((error) => {
console.log(error)
})
.finally(() => {
});
}
}
</script>
<style lang="">
</style>