I am trying to: search for custom post in view by post title or custom field
Link to a page where the issue can be seen: hidden link
I expected to see: custom post, which has original not in main language and has been translated to main language
Instead, I got: I don't see it
This is the custom post: hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
To investigate this, I'll need to see how this view and the missing post are set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
The 'HighSchools' post "Европейский Университет Прикладных Наук" is not showing in the view's search results, because the view "HighSchoolSearchViewPolo" is set to order results, by the field "Post View Count".
( screenshot: hidden link )
If you'll change this order setting to anything other than this field (e.g. post title or post ID), you'll see that the missing post starts showing.
It appears that this post was originally added in the german language, which includes a value for this "Post View Count" field.
( {yourwebsite.com}/wp-admin/post.php?lang=de&action=edit&post_type=highschool&post=32123 )
But, since 'Don't translate' is set for this field, its value was not copied to the other language translations.
( screenshot: hidden link )
To make this custom field's value in-sync across the languages, you'll need to select the "Copy" option.
( ref: https://wpml.org/documentation/getting-started-guide/translating-custom-fields/ )
Hi! Thanks for the explanation. It make sense. But in the same moment this is not clear why default value has not been created in translation. The field Post View Count has default value "0". So, I expected that it will be initially added with this value to all translation and then it should be shown in view with order by this field. Is it correct?
Thanks for writing back.
The way the "Default Value" option in Toolset Types field settings work, it only pre-fills the default value in the field, when a new post is being added through the post edit screen or through the front-end Toolset Forms (only if the field is actually included in the form). And when the post is submitted for the creation and if the user has not made any change to the default, only then the default value is saved as a custom field value.
Because the default value logic is not attached to the actual process of new post creation, it doesn't get executed for the translation posts.
For what you're planning to achieve, selecting the "Copy" or at least the "Copy once" option for the "Post View Count" field would be more appropriate.
Thanks a lot for the explanation. It is was not really clear how it works before. This solve my current issue, but it still not clear what to do if I want some field to be different in different languages. As some count of post views in different languages.