Trying to find the location of a rewrite of the URL query

Question

After my original question was deleted, I’ll try this another way.

Here’s the problem.

If I update my WordPress from 5.4 to 5.5, some pages are missing some information. I have a folder-like structure of pages (not posts) with parents and children. The site is about appartments and houses. So I have an URL like:

WP_ROOT/objects/rent/object_details/12345

These are the pages in order of their parents:

  1. WP_ROOT (like example.com)
  2. objects (is a page, parent of rent)
  3. rent (is a page, parent of object_details)
  4. object_details (is a page)
  5. 12345 is not a page! It’s just an ID (int) by which I can pull the corresponding data of the house or flat or whatever into the template.

So, in the template of object_details, I read the object_id like this:

<?php $id = str_replace( array("/objects/rent/object_details/", "/"), "", $_SERVER["SCRIPT_URI"] ); ?>

So far so good. In WP 5.4 this works like a charm. In WP 5.5 it doesn’t! The object_id gets erased, so that $id in the script above becomes NULL, or "". And in the browser I find myself in WP_ROOT/objects/rent/object_details/, so I’m redirected via 301.

Since I already got deleted once, because this `is obviously not a problem with WP but a custom tweak,´ so I’ll ask it the other way around:

How would I go about accomplishing such a thing in WP?

Maybe that way I can find out, what happened here…

0
chris_blues 2 months 0 Answers 8 views 0

Leave an answer