loop – 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_year%/%muz_category_name%', 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.

Any starting point is much appreciated, so…

Thanks in advance!

pictoru 10 months 2022-04-18T04:58:38-05:00 0 Answers 0 views 0

Leave an answer