post__in filter for cpt
-
Hi Mikko, I need some advice on a use case.
My WP has various cpts, one of them is “products” which is composed only of a title and an acf containing a Product ID. I need this to connect this cpt to an external management system.
When I do a search of course my text data is just the title. To overcome this problem and also allow text searches on other fields (of the external management system), I have developed my own PHP function that searches the external DB and responds with an array of IDs based on the search string received. I then built my own search page where I created a new WP_Query and as args:
‘post__in’ => $myFunction(),
This works. I would like to know if I can also insert this operating logic into the wordpress search (with relevanssi), naturally the IDs received from my function are the IDs of the wordpress “products” cpt (not of my management system), and this filter for “post_in ” should only be done on the “products” cpt.
Thanks in advance ??
- The topic ‘post__in filter for cpt’ is closed to new replies.