Navigation überspringen

[Gelöst] Rewriting urls to remove query string syntax

This support ticket is created vor 1 year, 4 months. 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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 1 reply, hat 1 Stimme.

Zuletzt aktualisiert von Saul Baizman vor 1 year, 4 months.

Assistiert von: Minesh.

Author
Artikel
#2795355

Hi there,

We've created a page which houses a view. The view is passed a URL parameter via a query string like so:

versteckter Link

We'd like the URL to look like this:

versteckter Link

Is that possible via custom PHP code? Can I add a custom rewrite rule? I attempted to add a rewrite rule (below), but it didn't work:

add_action ( 'init', callback: , 'add_rewrite_rules', priority: 10, accepted_args: 0 ) ;
function add_rewrite_rules ()
{
	add_rewrite_rule('^(inside-out-archive-experiment)/([0-9]{4})/?$', 'index.php?pagename=$matches[1]&prog-year=$matches[2]','top');
}
add_filter ( 'query_vars', 'add_query_vars' );
function add_query_vars ($vars)
{
	$vars[] = 'prog-year';
	return $vars;
}

Thank you.

Saul

#2795375

Minesh
Unterstützer

Sprachen: Englisch (English )

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

Hello. Thank you for contacting the Toolset support.

View's URL param are required to filter views correctly as well as for pagination hence there is no such feature to rewrite the view's URL param.

#2795444

OK, thanks, Minesh!