Skip Navigation

[Resolved] Uncaught Error: Call to undefined function toolset_get_related_posts()

This support ticket is created 5 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Shane 5 years ago.

Assisted by: Shane.

Author
Posts
#1373211

This is my code - at the moment I just want to output the posts in the relationship for a particular post. But I get an undefined function error. This code is placed in my functions.php file.

Thanks for any help!

$child_posts = toolset_get_related_posts(get_the_ID(), 'business-product', 'parent',100, 0, array(), 'post_id', 'child');
print_r($child_posts);

I am trying to:
Query the related posts in functions.php

Link to a page where the issue can be seen:
It can't really, it's going to be a feature to hook in to save_post. But for now, I'm just trying to output the results.

I expected to see:
An array of IDs in the relationship

Instead, I got:
Fatal error: Uncaught Error: Call to undefined function toolset_get_related_posts()

#1373239

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jean,

This is actually being used out of the context.

I believe this function is only available to be used on page and not in the functions.php.

If you want to add the function here you can, however you must wrap it as a shortcode and then call the function from an actual post page.

The way you have it now it wont work.

You can use the link below to generate your custom shortcode.
hidden link

Please let me know if this helps.
Thanks,
Shane

#1373243

Ah okay, thanks Shane.
I did have it in a function, but wasn't getting any output from it - so I dragged it out just to test what I was getting!
Will do that instead and report back 🙂

#1373261

Thanks Shane, all sorted! It's now working nicely within a function in functions.php! Hurrah!
Thanks for your help 🙂

#1373363

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jean,

Awesome.

Happy I was able to help you out.

You can go ahead and mark this one as resolved.

Thanks,
Shane