Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a priority for the ACF/qTranslate format filter #740

Merged
merged 3 commits into from
Oct 6, 2019

Conversation

henriqueccruz
Copy link
Contributor

So it avoids a problem when using translatable fields on custom admin screen (ACF options page)
More on that here: https://www.advancedcustomfields.com/resources/options-page/
If not, priority 10 is going to be automatically assigned and fields will return empty.

So it avoids a problem when using translatable fields on admin (ACF options page)
If not, priority 10 is going to be automatically assigned and fields will return empty.
Set a priority for the qTranslate format function
@herrvigg
Copy link
Collaborator

herrvigg commented Oct 5, 2019

hello, thanks for this!
Just wondering why the priority 5 and not higher. Usually it's better to put the highest possible value (when below 10).

Also, from the link you gave i can't find any information about the rationale behind this change. Which part were you pointing out?

@herrvigg herrvigg added the plugin: others Concerns integration with other plugins label Oct 5, 2019
@henriqueccruz
Copy link
Contributor Author

Because I ran into a very specific problem. The image field, when translated inside an option page (the page I linked above contains guidelines on how to create one) returned empty.
Setting the priority to anything less than 10 (9 for an example) solved the problem.

You can replicate the problem creating an option page (it works just like a theme option page, in the lateral menu), create a custom field item and a translatable image field inside.

Everything works as it should, until you try to fetch data to use, with functions like get_sub_field or get_field. It simply returns empty, which doesn't happen at all when using a normal image field.

Didn't confirm if it happens with other translatable fields in these conditions, though.

@herrvigg
Copy link
Collaborator

herrvigg commented Oct 5, 2019

OK i'll give it a try later just for double check. Anyway this will be merged soon.

@herrvigg herrvigg merged commit 51275c0 into qtranslate:master Oct 6, 2019
@herrvigg
Copy link
Collaborator

herrvigg commented Oct 6, 2019

@henriqueccruz i couldn't try this because it requires ACF PRO which i don't have. But this looks fine, i just added an extra comment. Merged in master.

@herrvigg herrvigg added module: ACF Integration with ACF and removed plugin: others Concerns integration with other plugins labels Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ACF Integration with ACF
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants