Skip Navigation

[Resolved] rewrites don't work properly with view filters

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
- 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)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 5 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1341671

I've added the following rewrite:

add_rewrite_tag( '%cc2%', '([^&]+)' );
add_rewrite_rule( '^cc2/([^/]*)/([^/]*)/?', 'index.php?c=$matches[1]&wpv-city=$matches[2]','top' );

and an archive view with some filters (including city)

so when I open /?c=cat&wpv-city=city , city filter is selected properly
but when I open /cc2/cat/city, city filter is empty

Site is fresh, nothing is installed but default theme and toolset. Rewrite is added through code snippet.

#1341827

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Actually, As you know this requires custom rewrite rules and Toolset do not offer any solution to set custom rewrite rules.

Normally, Toolset views actually needed the URL params in request URL to filter the results and for pagination rather than pretty URL for which you added the custom rules. You may contact the URL rewrite experts if you still want pretty URL with your archive view.

#1342263

https://toolset.com/forums/topic/when-using-the-latest-version-of-wp-views-plugin-issue-with-add_rewrite_rule/

from this thread, I assumed that toolset is supposed to support it, or maybe was supporting it in the past

#1342533

Minesh
Supporter

Languages: English (English )

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

As you shared the old post and I'm also able to locate one old post where I can see its not possible to have pretty URLs for view's filter params.
=> https://toolset.com/forums/topic/how-to-use-an-add_rewrite_rule-to-create-friendly-urls-to-pre-filtered-content/#post-366327

As I acknowledged before, Normally, Toolset views actually needed the URL params in request URL to filter the results and for pagination rather than pretty URL for which you added the custom rules.