Skip Navigation

[Resolved] How to get short URL of a value from URL field?

This thread is resolved. Here is a description of the problem and solution.

Problem:
Is it possible to output a URL stored in a Types URL field as a shortened-URL?

Solution:
No. It might be possible to produce a custom solution if the URL-shortening service has an API, otherwise you would need to store the shortened URL (which you might get by pasting the normal URL into such a URL shortening service) directly as a custom field.

This support ticket is created 5 years, 3 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Himanshu Agarwal 5 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#1176821

I have a URL field and I want to use it like a link in view or in a template like:-

<a href="[value-of-url-field]">some-text</a>

But I need to get short URL of this value from URL field.

This mean if value of URL field is hidden link then it convert into goo.gl/PeVJxo or any type of short URL.

Please help to achieve this.

#1176882

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

That is not possible. If you have a URL such as hidden link and you want to output a shortened version of that URL, you would need to go to a URL shortening service, paste in your URL, then copy the resulting short URL and save that URL as your custom field value.

Note that the goo.gl URL service is being discontinued (hidden link).

You could try and alternative such as hidden link.

They have an API, so you may be able to programmatically send your normal URL and retrieve a shortened URL, but setting that up would be outside of the support we offer, you would need to contact a developer if you are unable to do so yourself.

#1179881

Thank you Nigel.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.