• Resolved TrishaM

    (@trisham)


    Greetings all….this is rather urgent as site was moved today to new site (using the same domain, just pointing to new folder/db on the server) and one category page refuses to cooperate, unfortunately it’s a highly active one.

    On old site we had Custom Post Type of “news”, which when moved to new site was transitioned into a regular Post with a category of “news” assigned to all the posts of that type that were changed.

    Single Post URLs are fine because old site didn’t use any category base, just site.com/%postname%

    However, when we click on the (new) menu item for the (now) category page (formerly a archive page for the CPT), instead of going to site.com/category/news/ as it should, it is continually redirecting to site.com/news/ (which is the old structure).

    Here’s what I’ve done so far to try to find the source of the problem and fix it:
    – I’ve flushed the rewrite rules (many times in fact) by updating the Permalinks in Settings>Permalinks;
    – I’ve combed through the .htaccess file, nothing there but to be sure I removed it and allowed WP to rebuild a simpler version;
    – I’ve searced the DB for any old CPT detritus, found nothing – a SQL query to list post types does not show the old CPT in the list;

    I’ve also tried setting up some rewrite rules in the new .htaccess file, with no luck, trying both ModRewrite and Redirect, like so (neither of these worked, yes the server is running Apache):

    RewriteEngine On
    RewriteRule ^news/(.*)$ category/news/$1 [R=301,NC,L]
    (no effect at all)

    Redirect 301 /news https://www.[sitename].com/category/news
    (this causes circular redirect errors)

    The menu item is linked appropriately to the category, but clicking on it you can watch the redirect happen, same if you type in the URL using /category/news…..it switches quickly to just /news and then I get a 404 Page.

    The old CPT is no longer registered, there is nothing in .htaccess to cause the redirect (and redirecting back doesn’t work) so there must be something else that I’m missing……how or where might a redirect be hiding? There was no redirect ever on the old site so I have no idea where this is coming from…

    Please reply only if you really think you can help…..replies such as “wow that’s a bummer did you try XXX? (XXX being something I list above as already tried) just removes this from the no-replies filter making it less likely I’ll get help from another developer or moderator…..and this really is urgent.

    Thanks for viewing, hoping some server experts may chime in!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you using any CPT plugins? If so, have you disabled them? Are their settings removed from the database? Have you checked your server error logs? Have you tried enabling WP_DEBUG?

    this is rather urgent

    Please reply only if you really think you can help…..replies such as “wow that’s a bummer did you try XXX? (XXX being something I list above as already tried) just removes this from the no-replies filter making it less likely I’ll get help from another developer or moderator…..and this really is urgent.

    In general, it’s bad form to mark your threads as “urgent” in any forum. Everybody’s problem is urgent to them, and all the advice on this forum is provided by volunteers. If it is highly urgent (especially if this is for a commercial site), you should try https://jobs.wordpress.net/

    Thread Starter TrishaM

    (@trisham)

    @kjodle thanks for the reply, this is probably the first time I’ve asked for help ‘urgently’, and I’ve been a forum member for many years, I also help out answering questions when I have spare time.

    All testing on the site before moving the domain went perfectly, including this category link…..it only started redirecting after we pointed the domain to this site, now there is no going backwards and I need to get this fixed.

    To answer your questions, the old CPT (news) was added by the old Theme. I did quite a bit of research and although a number of support forum posts (respondents) say that it isn’t necessary to unregister a CPT, I did that anyway via the new Theme’s functions.php, but it didn’t make any difference. Before doing that the (custom) posts were successfully changed to be (regular) Posts with a new category (‘news’) assigned.

    Yes, I’ve checked server errors and tried using WP_DEBUG. There are no errors being given……it just redirects.

    I also searched the database for any instance of the string ‘news’ and the only place it appears is where I would expect it to be, given that it is now a Category, it’s in the wp_terms table….nowhere else.

    SO I’m stumped and hoping someone will have a flash of inspiration about where I can look next, I really don’t want to have to start over, but will if I can’t get it figured out in a day or so.

    I really don’t want to have to start over, but will if I can’t get it figured out in a day or so.

    I would try cloning this into a localhost environment where you can play around with it without affecting the live site. In fact, you could start with a fresh install there, and just add things (themes, plugins, child themes) in until you find what is causing the problem. You could even remove any database tables that are not related to WordPress core. Sometimes you just really need to dig deep into the plumbing on some of these issues.

    My advice about marking things as urgent is based on my experience as a moderator in other forums. From behind-the-scenes and offline discussions, I have found that this actually discourages a lot of people from offering help. You have an interesting case, and I really do want to help get this sorted for you.

    Thread Starter TrishaM

    (@trisham)

    Thanks @kjodle I really do appreciate all your thoughts…..I’m going to give that exact process a go in the morning, my brain is fried from this right now. I’ve been working with WP since version 1.0 and it’s very rare that something stumps me like this. However it goes, I’ll update this sometime no later than mid-day tomorrow.

    Thread Starter TrishaM

    (@trisham)

    @kjodle thought you might be interested in how this turned out….

    I did start with a fresh install and imported the existing database using phpMyAdmin (exported from the site with problems and imported it to the new DB), then I did remove some tables that were added by a plugin (Simple:Press). Those were old forum posts that weren’t linked to from the website anywhere (the forum was taken offline a long time ago) so I decided now was as good a time as any to just get rid of them.

    The problem went away, testing was perfect so I pointed the domain to this new installation and all is good now.

    I cannot say for certain that the problem was caused by Simple:Press, seems like the forum would have nothing to do with the Custom Post Type content being switched to regular Post content, but who knows? Some mysteries never really get solved.

    In any case it was a long 4 days of stress but we’re back on track, thanks again for your suggestions…..sometimes the thing we want to do the least (start over) is still the right thing to do.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changed CPT to Post, now Category Page won’t work’ is closed to new replies.