Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Polylang and custom posts
- This topic has 11 replies, 2 voices, and was last updated 4 years, 9 months ago by
nicolab292.
-
AuthorPosts
-
August 9, 2021 at 9:08 pm #34228
nicolab292
ParticipantHello Ernest,
So this is me again, about the issue with Polylang filtering unassigned custom posts, even though I chose to disconnect the search from Polylang.
Probably you have a fix to offer , just like you had one with the free version of the plug-in.
Thank you
NicolasAugust 10, 2021 at 8:52 am #34237Ernest Marcinko
KeymasterHi Nicolas,
Sure! That code section is similar for both plugins, and the issue was discovered by you, so it is not yet fixed in the Pro version either. The fix is almost identical:
(make a backup first)
1. Look for thewp-content/plugins/ajax-search-pro/includes/classes/etc/class-asp_helpers.phpfile
2. Replace it’s contents with this
3. SaveHopefully all goes well and this will work.
August 12, 2021 at 11:28 am #34256nicolab292
ParticipantHello Ernest,
Yes, it works! Thank you. Now my specific search in my series of custom posts that do not have a language assigned is operational in both the languages that the website has.
I also built a “general search” in all the website, that covers both the main pages (that have two versions for language and are mangaged by Polylang ) AND my custom posts that aren’t managed by Polylang.
But, one of the two things happen:
– if I apply Polylang compatibility, the custom posts are filtered
– if I don’t apply Polylang compatibility, the results in the main pages are doubled : both languages come upI don’t thing there is way around that, is there? Ideally I would like to have the results in the current language for the main pages + the custom posts. But I understand that this comes from the fact that Polylang filters content that is not in the current laguage, even though these posts are excluded from the scope of what it is supposed to deal with.
Best regards,
NicolasAugust 12, 2021 at 12:34 pm #34262Ernest Marcinko
KeymasterHi Nicolas,
Tough question, that might not be possible, I am not sure.
If you want, you can add temporary back-end and (s)FTP details, and I can try experimenting with the code directly – but I honestly don’t know if there is a way to get both with the query.
August 16, 2021 at 1:02 pm #34286nicolab292
ParticipantYou cannot access this content.
August 16, 2021 at 3:44 pm #34287nicolab292
ParticipantYou cannot access this content.
August 17, 2021 at 1:53 pm #34291Ernest Marcinko
KeymasterThanks!
I made a modification, but I don’t know if it works. It basically allows matches, where the polylang language is not assigned. However, if polylang does not assign a language code to the default language posts, then this will not work, and is not possible to resolve unfortunately.
Can you please check and verify?
August 22, 2021 at 6:14 pm #34333nicolab292
ParticipantHello Ernest,
Sorry for the delay in answering. I’m not in the lab these days, and I missed the message in the webmail.
Well, from what I can see, now, even with Polylang compatibilty ON, the General search outputs pages in both languages. Try my name ‘Nicolas Rey’ or ‘Kodak’ and you can see this.
So it doesn’t work like I would want it to work: only the current language + custom posts.
Let me know what you think. If it is too complicated, just put it back the way it was, and we’ll just live with what we have I guess…
Thank you , I’ll try to be more careful with e-mails in the coming days.
Best regards,
NicolasAugust 23, 2021 at 7:52 am #34335Ernest Marcinko
KeymasterThank you for the feedback. I have restored the original. I was afraid this was going to happen – it seems like the main language is not stored as I was hoping. Unfortunately it seems like this is not possible then.
August 23, 2021 at 8:44 am #34338nicolab292
ParticipantOk; thank you for trying!
Best regards,
NicolasAugust 23, 2021 at 9:25 am #34339Ernest Marcinko
KeymasterYou cannot access this content.
August 23, 2021 at 11:46 am #34340nicolab292
ParticipantYou cannot access this content.
-
AuthorPosts
- The topic ‘Polylang and custom posts’ is closed to new replies.