Skip Navigation

[Resolved] How to sanitize the custom field value

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

Problem:
How to sanitize the custom field value

Solution:
To sanitize the custom field value - you should do it using standard wordpress hook save_post.

You can find proposed solution, in this case, with the following reply
https://toolset.com/forums/topic/post-url-as-parameter/#post-901495

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/#an-example

This support ticket is created 6 years, 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 6 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#901303

Hi,
I would like to create a link in the post body which contains a Type custom field, the current page name and its url as parameters.

As an example, to pass these parameters from "Start Page" to "End Page", I would insert this link to the "Start Page" post body:

hidden link{!{types field='customfield' format='FIELD_VALUE'}!}{!{/types}!}&pagename=Start%20Page&url=https%3A%2F%2Fmydomain.com%2Fstartpage%2F>CLICK HERE

The Toolset shortcodes generator allows me to sanitize the post name, but how do I sanitize the custom field?
Is it also possible to encode the url?

Thanks

Best

#901495

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - to sanitize the custom field value - you should do it using standard wordpress hook save_post.

Please check the following code example:
More info:
=> https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/#an-example