I have recently upgraded from wordpress 4.7 to 5.8 (I know a bit of a big jump).

In the old version I could dynamically change the page content using the following url structure: example.local/courses/1234/?title=something In this example, the url will remain the same, but contents of course id#1234 is loaded into the page. Since the upgrade what happens now is that the website goes to the homepage of the website ie. example.local so it seems that it is not interpreting the url parameters at all.

If I don't add anything to the end of the url ie. example.local/courses/, then the page shows the list of courses (so this is still working fine).

My functions.php file has not changed (as I didn't upgrade the theme) and my .htaccess hasn't changed.

Ive flushed the permalinks each time I make a change but still no help.

The url that does work however is example.local/courses/?id=1234&title=something so I could resort to this. However it isn't ideal as google has indexed the website (and the other websites as it is a multisite) using the old url structure.

Thanks in advance for any help at all.

Update with some extra info:

  • the title parameter does nothing - it is just there for SEO purposes.
  • I have disabled all plugins (minus the one I wrote that handles the display) and it still doesn’t work
  • my custom plugin and parent (I didn’t upgrade this) and child theme are exactly as they were under the old wp version
  • my customised template handles getting the URL parameters however this file doesn’t even seem to run now when you use the URL with /courses/1234/ as I have an exit at the start and that doesn’t run.
  • in my custom template I extract the courses id ie 1234 which I use to call some Ajax which gets the course details from an external source and displays the results
  • the only rewrite rule I have handles 404 errors to stop wp guessing the correct page
  • I'm not 100% certain but believe this is not core WP behaviour. Meaning you must have some custom setup (either via plugins or custom code) that enables this. And most likely situation is that this custom setup is not working well with WP 5.8. First, If that is the case, first you should find out why it worked before - then you can try to fix it for more recent WP versions.
    – kero
    Commented Sep 2, 2021 at 8:31
  • is title a custom parameter in your template? How is /courses/1234 implemented? WP Rewrite rules? Is 1234 a post ID for a course CPT? Use the edit link to update your question with all this information ( even if the answer is that you do not know )
    – Tom J Nowell
    Commented Sep 2, 2021 at 8:54
  • Thanks for your comments. I have added more info in the question. Hope this helps Commented Sep 3, 2021 at 0:50

1 Answer 1


After a lot of research and trying different things, I came across this page https://core.trac.wordpress.org/ticket/50976 which wasn't exactly the same as my problem, but the cause of this was also what broke my site.

To get around this, without having to change my URL structure and therefore get google to reindex all my pages, I had to get a list of all the pages using certain templates (that made use of the example.local/courses/1234/?title=something) and then create an add_rewrite_rule for each of the pages.

 * Register new rewrite rules
function rewrite_pagination_rules_for_content_items() {
    /* get list of pages the rewrite is required for based on a particular template used */
    $pages = get_list_of_paginated_pages();

    foreach($pages as $page) {
        /* strip off domain name and first slash */
        $domain_start = strpos($page['url'],'://');
        $domain_finish = strpos($page['url'],'/',$domain_start+3);
        $url = substr($page['url'],$domain_finish+1);
        $post_id = $page['id'];
        //echo '<br/>url = '.$url.' post id = '.$post_id;
add_action('init', 'rewrite_pagination_rules_for_content_items');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.