Looks like all I needed was to include 'posts_per_page' => -1
in the $query_args
array.
Final, working code:
<ul class="tag-list">
<?php
$query_args = array(
// Easier to call the parent category, "recipe" instead of dealing with all these ids
// 'cat' => '101,94,93,56,72,99,100,63,98,95,96,80,4',
// Calling recipes (4) and ingredients (56) category ids - specific recipe types that are children of recipes get included
'category__in' => array( 4, 56 ),
// Grabs all posts, not just the ones on the first page
'posts_per_page' => -1
);
$query = new WP_Query( $query_args );
// $query = new WP_Query( 'author_name=centehua' );
$posttags = "";
while( $query->have_posts() ) {
$query->the_post();
if( get_the_tag_list() ){
$posttags = $posttags . get_the_tag_list('',',',',');
}
}
wp_reset_postdata();
// Explode tags in array
$sortedtags = explode(',', $posttags);
// Sort array
asort($sortedtags);
// Remove duplicates from array
$sortedtags = array_unique($sortedtags);
// Remove the blank entry due to get_the_tag_list
$sortedtags = array_values( array_filter($sortedtags) );
foreach ($sortedtags as $tagname) {
echo '<li>' . $tagname . '</li>';
}
?>
</ul>