Skip Navigation

[Resolved] using custom field in page url

This support ticket is created 6 years, 2 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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 6 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1119908

hi , for seo page url purpose, i need to append a custom field in the page url, is that possible ?

current url : site.com/post-type/ listing-name

prefer to have : site.com/post-type/custom-field-name/ listing-name

Pls advice the approach or if there is any ready sample to follow.

Thanks

#1120741

Hi there,

Thank you for contacting us and I'll be happy to assist.

As the permalinks and their rewriting are managed by the WordPress, this question is better suited for the WordPress forum.

You'll get the most accurate and up-to-date information about possible challenges and drawbacks in adopting this approach:
https://wordpress.org/support/forums/

In theory, this will involve two steps,

1. Updating the saved permalink, when the post is saved, based on the custom field value.
( ref: https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/ )

2. Rewriting the URL itself.

Here is a link to a similar support thread on the topic:
https://wordpress.stackexchange.com/questions/294011/change-permalinks-with-acf-values

Note: As no two posts can share the same permalink, you'll also need to add a check that no two custom field values are the same.

I hope this helps! Please let us know if there's anything else we can help you with.