Skip Navigation

[Resolved] Use post names to generate intermediate post type name and URL slug

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

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1283545

Hey guys,

I'm wondering if it's possible to make the intermidiate relathionship post generate it's name and URL slug based on the two posts it connects. For example right now it just sets the name of the post type and what I assume are the two post ids as the url: integrations-4412-4430/.

I'd like it to look more like integrations-docusign-infusionsoft/

Video explaining: hidden link

#1283661

Hello,

I assume you are going to setup the intermediary post title and slug automatically.
If it is, there isn't such a built-in feature within Toolset Types plugin, but you can edit those intermediary posts, setup the post title and slug manually.

If you are familiar with PHP codes, you can try with custom codes, for example, when you relate a post with another post with many-to-many relationship, use wordpress action hook save_post to trigger a PHP function:
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

In this PHP function, get related other two posts:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post

Then update the intermediary post title and slug as what you want:
https://codex.wordpress.org/Function_Reference/wp_update_post