This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Carlos Rojas 1 year ago.

Assigned support staff: Carlos Rojas.

Author Posts
September 6, 2018 at 12:44 pm #2710711

rocket.works

Tell us what you are trying to do?
I have a custom post type (products). Those Post Types have ACF fields, but those fields are only present in the default_language translation (to keep the product data in sync, accross all translations). If you open the products in another language then the default language, it will get the data from the other language .

The search for values in the ACF fields works great, if the user is on the default language.
However, if the user uses another language, the products won't show up in the search results (because the data is not in the translated posts).

How can I modify the WPML search filter to allow me, to show the results of all languages for the products or even better how can I get the system to search for all languages only in the main language and then display the result the search in the selected language?

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
Website is currently in development and not public.

September 7, 2018 at 1:41 am #2712493

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello,
Thank you for contacting WPML support.

1.- I would like to ask you to follow this steps:
- Go to WPML -> Settings -> Custom Fields Translation -> Set the ACF you are using in the custom post type to 'Translatable - use translation if available or fallback to default language' -> Save the changes.
- Flush all cache memory.
- If the issue persists then edit one of the custom posts -> Re-save it -> Re-save the translations.

Could you tell me the result of this steps?

2.- Please increase the PHP Memory Limit. Minimum requirements are 128Mb: https://wpml.org/home/minimum-requirements/
You can add this to wp-config.php to increase WP memory:

/** Memory Limit */
define('WP_MEMORY_LIMIT', '128M');
define( 'WP_MAX_MEMORY_LIMIT', '128M' );

- Add it above the line /* That's all, stop editing! Happy blogging. */

Kind regards,
Carlos

September 10, 2018 at 7:24 am #2718941

rocket.works

Hello Carlos,

thank you for the reply.

Unfortunatly, this is not what I asked for. I don't want to have the fields translated.
The fields are only presistent in one (the main languages) post and therefore I need to let the search, search for other languages the main language too.

This is why I asks how I can hooke into and change the WPML search filter.

Thank you very much.

September 10, 2018 at 3:56 pm #2720617

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,

The steps provided doesn't translate the fields, but shows the infomation of the fields in the default language if the ACF is not translated. I believe this is worth trying and I recommend you to visit this link where you will find more information about this option: https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/

Regarding the WPML's hooks, in this link you will find a list with all of them: https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

I specially recommend you to take a look at this hook in case you decide to create your custom search function: https://wpml.org/wpml-hook/wpml_add_language_form_field/

Please let me know if you need further assistance and I will be more happy to keep helping you.
Best regards,
Carlos

September 18, 2018 at 7:06 am #2743737

rocket.works

Hello Carlos,

thank you for you help.

Unfortunatly it did not fix my problem.

What I basically need is to hook into the mechanism which removes the search results if they are in a different language.

Best thing would be to have it working normally, but not removing the results for a certain custom post type (products).

I need to somehow have WPML search in the german products if the user searches in english, but then returning the english permalinks and titel of the products.

Thank you very much.

September 18, 2018 at 9:34 pm #2746569

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,
Thank you very much for your message.

To get the search result in all languages you need to add custom code which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

Note: I also recommend you to visit this ticket where you will find a similar issue and might be helpful in this case: https://wpml.org/forums/topic/problems-to-show-in-all-languages-suppress_filters-true-not-working/

Please let me know if you need further assistance and I will be more than happy to help.
Best regards,
Carlos