I am using the SitePoint post to create a Post Series with Custom Post Type and have Custom Boxes for Post series number.
Below function is providing the list of all post published in the specific Taxonomy. Problem is it also listing the deleted & hidden posts as well:
function sitepoint_post_series_content_filter($content) {
$slug = "sitepoint-postseries";
if ($slug != get_post_type()) {
return $content;
}
$post_series_list = get_option("post_series_" . get_the_ID() . "_ids", "");
$post_series_list_array = explode(',', $post_series_list);
$post_series_serial_number = array();
foreach ($post_series_list_array as $key => $value) {
$serial_number = get_post_meta($value, "sitepoint-postseries-serial-number", true);
$post_series_serial_number[$value] = $serial_number;
}
asort($post_series_serial_number);
$html = "<ul class='sitepoint-post-series'>";
foreach ($post_series_serial_number as $key => $value) {
$post = get_post($key);
$title = $post->post_title;
$html = $html . "<li><h3><a href='" . get_permalink($key) . "'>" . $title . "</a></h3></li>";
}
$html = $html . "</ul>";
return $content . $html;
}
add_filter("the_content", "sitepoint_post_series_content_filter");
How can I exclude the Deleted & Hidden posts from this list.