Skip Navigation

[Resolved] View filtered by url parameter

This support ticket is created 3 years, 8 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 3 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#2039899

While I can filter a view using url parameters, like

hidden link

I was wondering if there is a more "safe" way to do that, and avoid people second guessing the id, by putting a random number as xxx.
Surely there're multiple ways, like adding a random string ID in a custom field, but it would be interesting to know if there's a kind of "security guideline" I can follow.
Thanks. Best.

#2040041

If you're filtering by post ID, there's not much you can do to make the system more secure because post IDs are generated and dictated by WordPress in a somewhat predictable way. A more secure way to filter would be to create a custom field that contains something more complex, like a globally unique identifier, and add a URL filter based on that custom field value. PHP contains some methods you could use to programmatically generate such a unique id, like https://www.php.net/manual/en/function.uniqid.php

I don't really have much in the way of documentation available, as this is a fairly custom implementation, but we offer the Forms APIs if you want to generate a unique identifier programmatically when a post is created with Forms:
https://toolset.com/documentation/programmer-reference/cred-api/

Otherwise, for more security you could consider adding password-protection to individual posts. WordPress provides that capability by default. Even if someone guesses the ID, to access the post directly they would need to enter a password. Toolset Access also provides security features based on User role, so you could prevent direct access to some posts with post groups and Access controls.