0
votes

I added date archives for custom post types as described in this Question (Date archives for custom post type), and they worked perfectly at first.

Problem:

E.g. if I clicked on the link URL/cpt-events/2014, it redirected to the date archive of 2014 as it should.

But now it redirects to the single post page of the first entry of 2014 and not to the archive page.

What I did:

I moved the WordPress folder from a sub folder root/wordpress/all files into the root folder root/all files.

  1. I set the new URL via the config file as described in WP docs. With these lines in the wp-config.php

    define('WP_SITEURL', 'http://www.my-url.xyz');
    define('WP_HOME', 'same URL');
    
  2. I also updated the wp_options in the database as described in WP docs and updated the domain for siteurl and home .

  3. I visited/saved/flushed the settings->permalinks several times.

Any ideas what the problem could be or where I should start looking?

1

1 Answers

0
votes

If you are moving wordpress from an URL to other, it's not enough to just update the config file. There are many options stored in the database, unfortunatly in serialized format.

So, when you move wordpress from one url to another do the following:

  • DO NOT OPEN in the browser

  • Download this script.

  • Move it in a folder called /wp-replace.

  • Enter http://example.com/wp-replace

  • Enter the string you want to replace withoud any / trailing character and without http://. For example: olddomain.com/blog and enter the new URL: example.com

  • Run it. You will see what changes applied.

  • Delete this wp-replace folder

  • Check your .htaccess and edit if needs.

  • Log in, and refresh in options / permalinks.

Now you can use your site.