public function set_post_contents( $post ) {
global $pages;
$pages = array($this->contents);
}
This function overwrites the global $pages to only include what is given in the route callback.
I fix this on my end (for the moment) just by doing this :
$pages = array($this->contents . $post->post_content);