Bug in td-composer v3.3: Cat. filter "Single – Related by category" is broken

Posted in: Newspaper
Post count: 3

For some reason the category filter in a single template for getting a list of related posts by current category is broken.

As workaround I had to change the following lines in td-composer/legacy/common/wp_booster/td_data_source.php:


345: case 'cur_post_same_categories':
346: //print_r($atts);
347: $wp_query_args['category__in'] = wp_get_post_categories($live_filter_cur_post_id);
348: $wp_query_args['post__not_in'] = array($live_filter_cur_post_id);
349: break;

to:


345: case 'cur_post_same_categories':
346: //print_r($atts);
347: $term_ids = [];
348: foreach (get_the_terms($live_filter_cur_post_id, 'category') as $term) {
349: if ($term->slug !== 'featured') {
350: $term_ids[] += $term->term_id;
351: }
352: }
353: $wp_query_args['category__in'] = $term_ids;
354: $wp_query_args['post__not_in'] = array($live_filter_cur_post_id);
355: break;

It seems that wp_get_post_categories() was returning an empty list.

Post count: 35449

Hi,
Thank you for letting us know about this situation and the solutions that you used!
Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.