disable wordpress from filtering slug

29 views
Skip to first unread message

barbara schendel

unread,
Jun 18, 2013, 12:18:59 PM6/18/13
to mpls-stpau...@googlegroups.com
Hey all,
I am using a lightweight event calendar plugin (so that I can have the nice calendar view of all events), with a gravity form for registration embedded into the event page (need to use GF because I will need conditional logic and calculate price) -- I would like to use the same gravity form for all events so I want to have event name, prices, etc be inserted dynamically. So I need to edit the permalink of the event to allow ? and = signs. (every time I hit Update it removes these symbols)

Anybody know how I can prevent WP from sanitizing my permalink slugs?

(I know it's a security thing. Maybe I can override it just for this post type or something?)

let me know if you can think of anything. Thank you!!
-barbara-

Nicholas Ciske

unread,
Jun 19, 2013, 10:59:34 AM6/19/13
to mpls-stpau...@googlegroups.com
Even if you could, I'd advise against it. WP relies on the slug being sanitized -- I suspect you'd break a lot of things if it was not.

The better solution would be to do one of these:

filter the_permalink:
Check for your page slug(s) and append the query vars to the end there, probably via add_query_var to be safe.

redirect:
Add some logic at the top of the page template (or filter template_redirect) to redirect to itself with query vars attached if the query vars are not set.

rewrite a custom url structure (may not work for your sitution, but I wanted to mention it):
e.g. /eventform/x/y/z .... => /event-name/?var1=x&var2=y&var3=z

WP Router makes this easier than dealing with the raw API.

Nicholas Ciske

unread,
Jun 19, 2013, 11:05:55 AM6/19/13
to mpls-stpau...@googlegroups.com
Or setup those pages with some meta data that store the preset values and set them via altering $_GET just before the gravity forms loads (there's a gravity form filter for that).

e.g. If you want that data saved with the page, meta data is the best way. If you want to dynamically generate it, then just tweak any URLs pointed at the form via add_query_var.

_________________________
Nick Ciske
Web Design & Development | Business Consulting 
@nciske

barbara schendel

unread,
Jun 19, 2013, 11:22:05 AM6/19/13
to mpls-stpau...@googlegroups.com
Yeah that is sort of what I ended up doing. I decided I could live without the pretty calendar so I just created a bunch of posts with custom fields containing the important variables, and then I built a template that lists all the events with their own links that prefill the form when clicked.

thanks!!



--
You received this message because you are subscribed to the Google Groups "Minneapolis St. Paul WordPress User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpls-stpaul-word...@googlegroups.com.
To post to this group, send email to mpls-stpau...@googlegroups.com.
Visit this group at http://groups.google.com/group/mpls-stpaul-wordpress.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages