Skip Navigation

[Resolved] Post relationship field no longer working for new posts after Toolset update

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by paulC-5 5 years, 6 months ago.

Author
Posts
#1286051

I'm using a "Post Reference" field type for one of my CPTs and it is no longer working after a Toolset update. My old CPT posts are still getting the data, but not my new ones. What's more if I update an old post the field stops working (for logged users only). I believe this is the problem.

https://toolset.com/forums/topic/post-type-fields-are-not-saved-correctly/
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#wp_query-argument-for-querying-by-related-posts

This article shows how to edit code using WP_Query. I do have an archive page (that has this problem) but also a single-CTP.php page that uses:

$download_file = get_post_meta( $post->ID, "wpcf-download", true);
echo 'the download file is ' . $download_file;

Nothing is displayed for new posts. I've also read this about using relationship slugs:
https://toolset.com/forums/topic/relationship-slug-change/#post-784807

The Field slug for this Post Relationship field is just download. But when I try using this neither old or new posts display my $download_file.

TIA
Paul

#1286081

Sorry found a link to API changes and using this fixed it:
toolset_get_related_post