Tutorial Seems to be Incorrect
-
I used the code you shared in your tutorial:
$pod = pods( ‘pod_name’, get_the_id() );
$related = $pod->field( ‘relationship_field’ );This page says that returns a multi-dimensional array of all of the items in the related field. That does not appear to be the case. It is an array – but not an array of related items, but rather an array of fields. That being the case, this code does not work if there is only one relative (I have not tested the case where there are more than one relative):
foreach ( $related as $rel ) {
$id = $rel[ ‘ID’ ];
}I suspect that this tutorial might need to be clarified to explain that the approach depends on how many relatives there are. Perhaps you can add additional code that checks for that? Also, the opposite scenario is needed – this is “get” code – we also need “set’ code.
The page I need help with: [log in to see the link]
The topic ‘Tutorial Seems to be Incorrect’ is closed to new replies.