Bug in td-composer v3.3: wrong parsing of filter by tag slug

Posted in: Newspaper
Post count: 3

Recently in td-composer/legacy/common/wp_booster/td_data_source.php at line 154, code changed from:

154: $wp_query_args['tag'] = str_replace(' ', '-', $tag_slug);

to:

156: $tag_slugs = explode(',', trim($tag_slug));
157: $tag_not_in = array();
158: $tag_in = array();
159: foreach ($tag_slugs as $td_tag) {
160: if ( !empty($td_tag) ) {
161: if (strpos($td_tag, '-') !== false) {
162: $tag = get_term_by('slug', $td_tag, 'post_tag');
163: $tag_not_in[] = $tag->term_id;
164: } else {
165: $tag = get_term_by('slug', $td_tag, 'post_tag');
166: $tag_in[] = $tag->term_id;
167: }
168: }
169: }
170:
171: $wp_query_args ['tag__in']= $tag_in;
172: $wp_query_args ['tag__not_in']= $tag_not_in;

The problematic line is the line 161 where it checks if “-” char is found in the tag in ANY position.
Now if a tag contains a legit “-” like for example “my-tag” it gets interpreted as an exclusion.
Exclusion should occur only if “-” is prefixed to the tag slug, in position 0.

Post count: 35449

Hi rboati,
As I know this problem should be already resolved, all you need to do it is to delete the current tagDiv Composer plugin and reinstall it from Newspaper > plugins -> https://i.imgur.com/ttGlDNn.png
Let me know the results!

Post count: 3

Hi Calin,
I can confirm that removing and reinstalling the plugin fixed the problem.
I checked before and after the update in the plugin panel and the td-composer plugin had same version and same build date (v3.3 built on 11.04.2022 7:46) so something went wrong during the previous update.
Do you know how this can occur?

Post count: 21065

Hello!

Check if you have some extra settings for the updates, maybe it could be a setting which do not let the plugins to be updated.

Thank you!

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