Templates and templateparts empty

@JohnD , @Araminta

I was able to narrow this down and (at least in my case) this is happening due to an exception being thrown when rendering a specific Query Block.

This Query Block is part of a template part and I was using a shortcode dynamic argument for the “Include Posts” filter.

Shortcodes always return a string, but the “Include Posts” filter expects an array. This causes the below exception to be thrown and prevents templates and template-parts from being rendered in the Themer.

PHP Fatal error:  Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, string given in /wp-includes/class-wp-query.php:2202
Stack trace:
#0  wp-includes/class-wp-query.php(2202): array_map()
#1  wp-includes/class-wp-query.php(3800): WP_Query->get_posts()
#2  wp-includes/class-wp-query.php(3932): WP_Query->query()
#3  wp-content/plugins/cwicly/core/includes/classes/class-query.php(372): WP_Query->__construct()
#4  wp-content/plugins/cwicly/core/includes/dynamic/render.php(178): Cwicly\Query::front_prep()
#5  wp-content/plugins/cwicly/core/includes/blocks/query/query.php(155): cc_render()
#6  wp-includes/class-wp-block.php(258): cc_query_render_callback()
#7  wp-includes/class-wp-block.php(244): WP_Block->render()

Please note that the exception prevents all template and template parts from rendering, even thought the exception is thrown while rendering a specific template.

After removing the shortcode dynamic argument, template and template parts are now rendered correctly in the Themer.

@msteinlein , you might want to check the logs for an exception thrown when loading the Themer. If you find one, it’s a matter of narrowing down the offending block.

@Araminta , maybe we can consider not allowing shortcodes as dynamic arguments for “Include Posts” filter?

On another note, I need to dynamically fetch the posts to be included in a query, and since using shortcodes isn’t possible as explained above, it would be great to be able to use a return Function in Query Dynamic Args.