List page is showing 404
I have built a new site based on a content from an old one. Also, there is some partial content in another WordPress blog which I have to import. Unfortunately, on the blog I don't have full access, but the owner shared the full backup file. I needed only some categories, not the entire blog.
So, I tried to import the file in a brand-new website, on a subdomain, but the export file was too big and the settings of the server didn't allow me to import the file (shared hosting). I've created another blog on wordpress.com, and I've imported the site there. After, I've exported only the necessary category. Unfortunately also having only few articles in the exported file, I couldn't import it because the import was crashed/blocked. The last solution was to import the articles manually. Bad and awful, I know. Anyway, I've started to import them and set the date to its original date in the blog, in the past.
On the newly created site, I've created a new permastruct to allow filtering the loop by category and year
$wp_rewrite-add_rewrite_tag(%muz_category_name%, '([^/]+)', category_name=);
$wp_rewrite-add_rewrite_tag(%muz_year%, '([0-9]{4})', year=);
$wp_rewrite-add_permastruct( 'category-archive', 'category-archive/%muz_category_name%/%muz_year%', array( 'walk_dirs' = false, 'paged' = true ) );
These links are working well, but for the year 2021 where I receive a 404. When I check the query, the year is added as the name argument, not the year.
Is this something that can be linked to the fact that the date of the post is set back in history? I checked the records in DB and I haven't found anything strange between these old posts and the newly created ones.
Also, I don't understand why I receive a 404 response. I expect something like No posts found on provided criteria or something like that. As I said, this happens only for year 2021. For the rest of the years, until 2012 everything works well.
So, trying the URL /category-archive/expozitii-temporare/2022
will search in the category Expoziții temporare
filtered by year 2022
. WP Query object looks like this:
[query] = Array
(
[year] = 2022
[category_name] = expozitii-temporare
)
Using /category-archive/expozitii-temporare/2021
the WP Query object returns:
[query] = Array
(
[category_name] = expozitii-temporare
[page] = 0
[name] = 2021
)
In fact, what I want is to alter main Loop Query to filter posts by category and year and still have a friendly URL.
Any starting point is much appreciated, so...
Thanks in advance!
Topic loop permalinks 404-error bulk-import Wordpress
Category Web