Archive per year of a custom post getting the wrong post

Try It You need is make a filter for wp_get_archives(); function custom_post_type_archive_yearly($where,$args){ $post_type = isset($args[‘post_type’]) ? $args[‘post_type’] : ‘post’; $where = “WHERE post_type=”$post_type” AND post_status=”publish””; return $where; } Call this filter Hook: add_filter( ‘getarchives_where’,’custom_post_type_archive_yearly’,10,3); New you can Disply your Custom Post: $args = array( ‘post_type’ => ‘your_custom_post_type’, ‘type’ => ‘monthly’, ‘echo’ => 0 ); var_dump(wp_get_archives($args));