Get WP Posts in Category
Last Updated: March 25, 2021
If you want to display all the posts related to a particular category you have the solution here.
You can use the WP_Query() to run the custom query
In the following example you can get the all posts in the category where the ID is equal to 10
$category_query_args = array(
'cat' => 10
);
$category_query = new WP_Query($category_query_args);
if ($category_query->have_posts()) {
while ($category_query->have_posts()){
$category_query->the_post();
// echo get_the_ID();
// ech0 get_the_permalink()
}
}