Answers for "wp get all the posts id of particular category"

PHP
-2

wp get category by id

<?php
$category_id = 21; //use your own category id
$category = get_category( $category_id );
echo $category->name;
echo $category->cat_ID;
//print_r($category);
//to get all the properties of the $category
?>
Posted by: Guest on July-24-2021
0

wp get_posts return ids

get_posts(array(
    'fields'          => 'ids', // Only get post IDs
    'posts_per_page'  => -1
));
Posted by: Guest on August-02-2021

Browse Popular Code Answers by Language