Forums › Forums › Search & Filter Pro › How can I get titles from ACF post object field? (instead of IDs)
Tagged: V3
- This topic has 46 replies, 3 voices, and was last updated 4 years, 7 months ago by
Ross.
-
Anonymous(Private) May 19, 2020 at 5:30 pm #244975
Hello,
I have 2 CPTs, Instructors and Courses. I’m using ACF (plugin Version 5.8.7) and in the Courses field group, I have a Post Object field (Instructors) that is set to return a Post Object. It allows me to relate the Instructor to a Course. All that is working as expected.
I’m using Search & Filter (plugin Version 2.5.0) to search the courses. I’m using several fields to filter the selections: course taxonomy, course post meta (art media), course post meta (instructor post-object) and date. all is working as expected except for the instructor post object. The filter is showing the post ID of the instructor, not the post title.
On the ACF side, I’ve tried switching to a relationship field but that didn’t change the post ID output.
On the S&F side I’ve tried using many different meta keys, to no avail. And with each iteration the cache needs to be rebuilt and it takes like 45 minutes. Very time consuming.
Ultimately, I’d like that filter to display the instructor (lastname, firstname) all as one filter-field. These are available as custom fields in the post type. Is that possible?
Any thoughts or insight is greatly appreciated. Thanks in advance!
Trevor(Private) May 20, 2020 at 1:15 pm #245120While I check this out, can you confirm whether or not you made the change suggested in this post:
https://support.searchandfilter.com/forums/topic/results-not-displaying-3/#post-222308
Anonymous(Private) May 21, 2020 at 5:11 pm #245357Trevor, I also asked this question of ACF. Here is there response:
I suspect that this is happening because the post object and the relationship field both save the post id in the database and the S&F plugin is only retrieving the saved value.
I can suggest that you reach out to the guys over at S&F and check if they have some native functions to format the output.Anonymous(Private) May 22, 2020 at 2:42 pm #245524Trevor, Thanks for sticking with me on this.
I understand you can get the lastnames to show up. But notice they are all empty (ie. 0 courses). It seems that field is not being related to the Course search that is happening.
I renamed the headings and added some screen shots to illustrate the difference.
The post meta “instructor” is now labeled “Instructor Field Pulls ID ONLY”. Note that this is limited to the instructor IDs for the courses available. That relationship is what I want to show, but I’d like to show the instructor Name in place of the post ID. https://www.screencast.com/t/QecSCWyX5
The post meta “last_name”, now labeled “Instructors by lastname” shows the name of the instructors, but none are related to the course search that is happening. If I check ‘Hide Empty’ the list is blank.
https://www.screencast.com/t/Hx5WRKGzcI want to show the instructor names (not ids) that are related to the courses being searched.
How can I achieve this?
-
AuthorPosts