Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter microcoder

    (@microcoder)

    Actually I’m using Search with Typesense (not Typesense for WooCommerce).

    I did not need the WooCommerce-functionality so I’m fine with this free plugin. Typesense for WooCommerce seemed unnecessary as my site is kind of custom and has no use of the WooCommerce-functionality (frontend) from the paid plugin.

    But if my problem is solved in Typesense for WooCommerce, that could be interesting to start using the plugin.

    After some investigation I found that my problems are the following:

    1. When I’m updating only the post image with the REST API the “wp_after_insert_post” is not triggered => no update in Typesense.
    2. When I’m creating a new post with the REST API => The post category is not found when I’m using the “cm_typesense_data_before_entry” hook. And because of that the post will not show up when I’m filtering on that category.

    Maybe this is out of scope of this support as it’s kind of custom. I just wanted to check if someone had a similar problem and knew a solution.

    Thread Starter microcoder

    (@microcoder)

    Due to my previous reply I checked how this is handled in the plugin and found this:

    /includes/Main/TypesenseAPI.php:167

    $category_names[] = html_entity_decode( $category->name );

    That confirms my previous reply and is the reason why it renders properly for the default category data ($formatted_data[‘category’]).

    Case closed.

    Thread Starter microcoder

    (@microcoder)

    Thanks for the response @digamberpradhan ,

    I did a fresh install with the standard theme to see if I got the same problem. I inserted a string “Foo & foo” into $formatted_data in the hook cm_typesense_data_before_entry and it rendered properly.

    I did some more investigation and found out that when I’m using get_the_terms() or get_the_title() the returning string is encoded. 

    Because of that, I tried to run the wp_specialchars_decode() function on my resulting values, like:

    $formatted_data['custom_value'] = wp_specialchars_decode(get_the_title($d));

    and then it works (proper rendering). Yay!

    Thanks for helping me out.

    Thread Starter microcoder

    (@microcoder)

    Update:
    I realized I could run the post titles through the _.unescape() function (edit the template). Then the titles will be displayed correctly.

    Now I just need to figure out how I can run the unescaping for the filter values.

    Thread Starter microcoder

    (@microcoder)

    Hello @digamberpradhan,

    I wrote a script based on your code and it seems to work.
    Thank you for the code example and your explanation.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)