0

I've a few post that have ACF relationship field set up :

- Post A
- Post A1
- Post A2
- Post A3

Post A have a relationship that link to : Post A1,A2 & A3...

Post A1,A2,A3 have their own post templates,

But inside the post templates, can I manage to get Post A's Title?

Because I don't want hardcoded Post A's title on Post A1,A2,A3's fields.

I'd tried this solution, but seems can't retrieve parent A's post object...

Below is my custom field settings on Post A's category, to select children products relationship ( which is A1,A2,A3 that mentioned above ) :

enter image description here

Thankyou

  • How is the relationship stored? Does ACF insert meta against Post A1, A2, A3 that says the parent post is "Post A" or? – userabuser Feb 22 '16 at 5:16
  • @userabuser I setup a relationship custom field on Post A. Then when i on Post A, I able to stored A1,A2,A3's post. The relationship fields seems doesn't have any settings for me to define parent / children post meta? I edited my question and posted a ss.... thanks! – Mavichow Feb 22 '16 at 5:24
0

Since ACF Relationships doesn't set any relationship as a parent or child,you'd be better of just getting the title from your post.

You could simply get the ID of your A page: the_title( '43' ); and output it like this, or if the post is actually a parent, you could simply do the_title( wp_get_post_parent_id() ); on your child template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.