79312324

Date: 2024-12-27 16:35:52
Score: 1.5
Natty:
Report link

you can follow these steps..

  1. For add rewrite rules:

    add_action('init', function () { add_rewrite_tag('%country%', '([^&]+)', 'country='); add_rewrite_rule('^directors/([^/]+)/?$', 'index.php?pagename=directors&country=$matches[1]', 'top'); });

  2. To prevent redirects:

    add_filter('redirect_canonical', function ($redirect_url, $requested_url) { return (strpos($requested_url, '/directors/') !== false) ? false : $redirect_url; }, 10, 2);

  3. for whitelist query variable:

    add_filter('query_vars', function ($vars) { $vars[] = 'country'; return $vars; });

then just save your permalinks again .. then clear your website caching if you are using the caching plugin.

Let me know after apply them.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Sihab Uddin