• Resolved charbi

    (@charbi)


    Hi, We’ve encountered an issue with how taxonomy terms are being handled in our pages for the Arabic language. Specifically, when a taxonomy term consists of two or more words, they are not joined together properly with an underscore (_). For example, the Arabic term “تصنيف جديد” should be transformed into “تصنيف_جديد” (with underscores connecting the words). Could you please update the logic to ensure that multi-word taxonomy terms in Arabic are joined together using an underscore (_) Or Provide us the file or configuration location where this logic is implemented to adjust it ? Thank you

    • This topic was modified 4 months, 1 week ago by charbi.
    • This topic was modified 4 months, 1 week ago by charbi.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author wpzinc

    (@wpzinc)

    The Plugin will remove spaces in Categories, without replacing them with an underscore, and append a hashtag before the Category. This is default behaviour, by design at the request of many users.

    If you wish to change the logic, either:

    1. Use the Pro version, using the {taxonomy_category_hashtag_underscore} option: https://www.wpzinc.com/documentation/wordpress-buffer-pro/status-text-tags/#taxonomies
    2. Create your own logic utilising the supplied wp_to_buffer_publish_parse_text_term_hashtag filter, changing the output as necessary to meet your requirements: https://www.wpzinc.com/documentation/wordpress-buffer-pro/developers/#wp_to_buffer_pro_publish_parse_text_term_hashtag
    Thread Starter charbi

    (@charbi)

    Thank you for your reply.
    I have been working with the solution provided to handle taxonomy terms in Arabic. I’ve applied the wp_to_buffer_publish_parse_text_term_hashtag filter to modify the term names and replace spaces with underscores. Unfortunately, the issue persists, and the desired outcome has not been achieved. The problem is noticeable with Arabic taxonomy terms that consist of two or more words. When such terms are processed, they are treated as a single, continuous string without any spaces or underscores between the words, which causes the terms to become meaningless.
    For example, the Arabic term “تصنيف جديد” should be transformed into “تصنيف_جديد” to maintain its meaning. However, with the current setup, the term is concatenated into something like “تصنيفجديد”, which is not only incorrect but also causes confusion and loss of meaning.
    It is crucial that the words in these terms be separated by underscores to preserve their meaning, especially in Arabic, where spaces between words hold significant importance. Without this modification, the terms are effectively useless when shared through Buffer.
    I hope there is a solution to this issue, and I would greatly appreciate your assistance in resolving it.

    Plugin Author wpzinc

    (@wpzinc)

    I’ve applied the wp_to_buffer_publish_parse_text_term_hashtag filter to modify the term names and replace spaces with underscores.

    Please provide the code you are using and how this is implemented. Thanks!

    Thread Starter charbi

    (@charbi)

    Here is the code I applied in my functions.php file:
    add_filter('wp_to_buffer_publish_parse_text_term_hashtag', function ($term, $taxonomy) { // Replace spaces with underscores in all taxonomy terms $term = str_replace(' ', '_', $term); return $term; }, 10, 2);
    Despite this, the taxonomy terms are still being concatenated without the underscore _. For example: • A term like “تصنيف جديد” is still output as “تصنيفجديد” instead of “تصنيف_جديد”.

    Plugin Author wpzinc

    (@wpzinc)

    You’re incorrectly modifying the first parameter, $term_name, which has already had spaces removed. You also call this $term, which is confusing, and fail to reference all parameters.

    You’re welcome to fully implement the filter, referencing the (correct) $term object parameter and including all and any logic you require for formatting:
    https://gist.github.com/n7studios/fc1498f2423cbdf3edb4904e1362f0b5

    Screenshots demonstrating working functionality:

    The above is provided as-is, untested, as an example for you to modify and self-serve support. Thank you!

    Thread Starter charbi

    (@charbi)

    The code you shared worked perfectly, and the terms are now being processed exactly as needed, with underscores replacing spaces. Your prompt assistance and clear guidance are greatly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.