Skip Navigation

[Closed] toolset_get_related_posts not working anymore

This support ticket is created 2 years, 8 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 12 replies, has 2 voices.

Last updated by Christopher Amirian 2 years, 7 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2337353

Tell us what you are trying to do?
the toolset_get_related_posts stopped working on our website

Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/

Is there a similar example that we can see?
hidden link

[code]
$oneBR = toolset_get_related_posts(
$parentFP[0], // get posts related to this one
'condo-floor-plan', // relationship between the posts
[
'query_by_role' => 'parent',
'role_to_return' => 'child',
'args' => [
'meta_key' => 'wpcf-fp-suite-type',
'meta_value' => '1BR',
'meta_compare' => 'LIKE',
],
'orderby' => 'title',
'order' => 'ASC',
'limit' => -1,
'return' => 'post_id',
],
);
[/code]

What is the link to your site?
hidden link

#2338271

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Would you please kindly provide the debug information?

https://toolset.com/faq/provide-debug-information-faster-support/

Also, would you please give us the details on the changes that you have done? Maybe after an update? Or some other change?

Thanks

#2338897

Hello Christopher please check the provided debug log. I think it happened after we updated the plugin

#2340165

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for providing the debug information.

At the moment what I see is that the version of Toolset Types and Toolset Blocks are old and you need to update them.

- IMPORTANT STEP! Create a backup of your website.
- Go to "WordPress Dashboard > Plugins > Add new > Commercial (tab)".
- Update Toolset plugins there.

After that would you please test the relationship creation without coding and with the GUI of Toolset and see if it works ok?

https://toolset.com/course-lesson/displaying-related-posts/

That way we can test the retrieval of the posts works ok in the first place or not.

Thanks

#2348991
Screen Shot 2022-04-25 at 4.06.55 PM.png

hello Christopher,

I don't see the option "display posts related to the current post" please advise

#2349415

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Would you please follow the steps below to make sure that you have the latest version of Toolset Types, Toolset Blocks, Toolset Maps, and Toolset Forms plugins?

- IMPORTANT STEP! Create a backup of your website.
- Make sure you are signed in wpml.org.
- Go to https://toolset.com/account/downloads/
- Download the latest version of the Toolset and its add-ons.
- Install them manually on your website:

https://toolset.com/forums/topic/plugin-update/#post-1600323

Please make sure that you have a complete backup of the website before doing the steps above.

After that, please try the relationship view again.

Thanks.

#2349595
Screen Shot 2022-04-26 at 9.04.49 AM.png

Hello Christopher,

the plugins were already updated prior to this reply

I also did a backup of the website

#2349627

Christopher Amirian
Supporter

Languages: English (English )

Ah I see, thank you. The debug information showed that the plugin version was old that is why I asked you to update it.

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also please give me the post types that you crewated relashionship on and the view that you want to create.

#2354335

Hi Christopher, Please enable the next reply as private, there is no option here that would allow me to do so

#2354349

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Done, please make sure that you set the next reply as private,

Thanks.

#2364897

Christopher Amirian
Supporter

Languages: English (English )

Screen Shot 2022-05-17 at 10.46.15.png

Hi there,

Thank you for the login information. So from what I understand you need to show the Floor Plans related to the Condo. So basically you need to show it on a single page of the Condo.

I went to Toolset > Dashboard and found out that you do not have a Template for the Condo. (Check screenshot)

Please create a template for the single Condo and there you will be able to select the proper relationship and it will show in the content selection in the view.

That is the place where the documentation below will work:

https://toolset.com/course-lesson/displaying-related-posts/

Thank you.

#2366237

Hello Christopher,

I am using the toolset_get_related_posts() function on my theme file

$oneBR = toolset_get_related_posts(
$parentFP[0], // get posts related to this one
'condo-floor-plan', // relationship between the posts
[
'query_by_role' => 'parent',
'role_to_return' => 'child',
'args' => [
'meta_key' => 'wpcf-fp-suite-type',
'meta_value' => '1BR',
'meta_compare' => 'LIKE',
],
'orderby' => 'title',
'order' => 'ASC',
'limit' => -1,
'return' => 'post_id',
],
);

this used to work but it doesn't work on this page:

hidden link

there are floor plans linked to it but it is not being displayed

#2366723

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

We will do our best to check your code, but please consider that it is considered as a custom development and outside of our support scope. As mentioned you need to create the template using Toolset and add the related items there as intended.

We will do our best to check your code to see if there is something that we can suggest, but it needs you to create a staging version of your website, so we can do the tests there and see if we can find a clue to help you.

Thank you for your understanding.

The topic ‘[Closed] toolset_get_related_posts not working anymore’ is closed to new replies.