Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Jaka Certanc

Show related post ACF value

Hello,

Difficult to explain: I have ACF field inside post that is actually a post relationship field. Related post has another ACF field which has some string value. Can I show this value in admin column when viewing and especially export it to CSV when doing export?

E.g. I have 2 custom post types:
– default post
– company
Post ID 100 is post_type=”post” with and has ACF field “Company” which is actually a relationship field that points to custom post type “company” post ID 200 called “Company LTD”.
Post ID 200 is post_type=”company” and has another ACF field called “Phone number”.
When viewing list of post_type=”post” I can display post title of custom post type ID 200 but I also want to display “Phone number” which is a custom field in related post.

I guess this can not be done directly but how can I manage something like this programmatically? For example with some filter/hook?

thanx!

1 year, 3 months ago
Stefan
Developer

I understand your use case and we indeed currently don’t have a column for it that does this for you.
If you use the ACF field, you can show the title, ID or author for the related field, but not the level deeper of relation you describe.

The only way to do that is by using the following hook:

ac/column/value

Or maybe even better, develop your own column instead of using the hook.

How to create my own column?

Since is it such a specific use case, I would personally go for a custom column instead of using the hook.

1 year, 3 months ago

You must be logged in to reply to this topic.