Saltar navegación

Este hilo está resuelto. Aquí tienes una descripción del problema y la solución.

Problema:
El cliente estaba utilizando la función

get_meta_values

para obtener un listado de los diferentes valores de un post meta, pero comenzó a mostrar los valores de los dos idiomas en lugar de solo el idioma activo.
Solución:
Recomendamos utilizar el hook

wpml_object_id

para asegurar que el contenido se filtre correctamente para cada idioma. Este filtro ayuda a recuperar el ID correcto del post para el idioma activo, asegurando que los metadatos de otros idiomas sean excluidos. Para más detalles sobre cómo implementar este hook, por favor consulta la guía en https://wpml.org/wpml-hook/wpml_object_id/.
Si después de implementar el hook el problema persiste, no dudes en compartir el código en tu próxima respuesta para que podamos revisarlo y sugerir qué hacer a continuación.

Si esta solución no es relevante porque está desactualizada o no se aplica a tu caso, te recomendamos abrir un nuevo ticket de soporte. También te sugerimos revisar los problemas conocidos en https://wpml.org/known-issues/, verificar la versión del arreglo permanente y confirmar que tienes instaladas las últimas versiones de los temas y plugins. Para asistencia adicional, visita nuestro foro de soporte en https://wpml.org/es/forums/forum/ayuda-en-espanol/.

Este es el foro de soporte técnico de WPML, el plugin multilingüe de WordPress.

Todas las personas pueden leerlo pero solo los clientes de WPML pueden ingresar comentarios. El equipo de WPML responde en los foros 6 días a la semana, 22 horas por día.

Etiquetado: 

Este tema contiene 1 respuesta, tiene 2 voces.

Última actualización por Prosenjit Barman hace 6 meses, 1 semana.

Asistido por: Prosenjit Barman.

Autor Entradas
septiembre 4, 2024 en 4:33 pm #16142055

Jesus Regulez

Antecedentes del problema:
Buenas
Usamos get_meta_values para obtener un listado de los diferentes valores de un post meta y hasta hace poco funcionaba bien pero ahora muestra los valores de los dos idiomas
Estoy mirando pero no encuentro el problema
Podrías ayudarme por favor?
Gracias

Síntomas:

Preguntas:

septiembre 5, 2024 en 6:08 am #16143152

Prosenjit Barman
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for contacting WPML Support.

To reduce the waiting time, I took this ticket and responded in English. Please let me know if you're okay with it or if you want to continue the conversation in Spanish language. I will check and forward this ticket to one of our Spanish-speaking supporters to assist you in the Spanish language.

I understand that the `get_meta_values` function is showing values from both languages. This can happen when the metadata is not filtered properly based on the current language.

To ensure the content is filtered correctly for each language, we recommend using the `wpml_object_id` hook. This filter helps retrieve the correct post ID for the active language, ensuring that metadata from other languages is excluded.

For more details about the Hook, please check this guide: https://wpml.org/wpml-hook/wpml_object_id/

Could you please double-check the code and ensure that the Hook is included?

While providing support for issues related to custom coding is typically beyond the scope of our support, if the problem continues after using the suggested hook, feel free to share the code in your next response. I'll review it and and suggest what to do next.

Looking forward to your response.

Best regards,
Prosenjit

septiembre 5, 2024 en 6:57 am #16143283

Jesus Regulez

Hi Prosenjit
Thank you very much for your help
In the end I solved it in another way
What you sent me is not useful for this case because I need all the values ​​of all the posts, not just one in particular

Thank you
Regards