• Resolved Roger H

    (@rwheindl)


    I developed a wordpress site located at “beta.domain.com/content” to be moved to “www.domain.com/content”, the production site when completed. I completed the development and followed the instructions at https://codex.www.ads-software.com/Moving_WordPress.

    With the files and database moved, I’m experiencing a problem where WordPress stops querying posts that get pulled up with a second loop. I’ll explain.

    In other words, on a specific wordpress “page”, I’m also running a second query that checks is_page('something'), then set a category number and run a custom database query using a new WP_Query object. We’re using the Starkers template and the customization is below the normal loop in page.php of the template.

    This works perfectly on beta.domain.com. When I move the site, the have_posts() method starts returning false and the posts do not show up.

    Using some php debug, I printed the contents of my custom WP_Query object and was able to retrieve the SQL query that was being executed on the database. I dumped the query into phpMyAdmin and VOILA – all the correct posts were there! What the heck?

    The procedure I used for migration was this:
    1. Copy the site files into the new directory.
    2. With beta still running, went to Admin->General and updated the two URL settings.
    3. Renamed the beta.domain.com/content to beta.domain.com/content_bak (so I wouldn’t accidentally try to use it).
    3. https://www.domain.com/content/wp-config.php is configured to use same database so no export/import needed.
    4. Loaded https://www.domain.com/content in the browser. Everything works except my custom category query. Admin area works fine. “Page” content loads up properly. The template works. The main blog of all the “posts” is properly showing everything.

    Thinking the database might be the culprit, I searched and replaced every instance of beta.domain.com with https://www.domain.com. That too produces the same result.

    I’ve since restored to the original, un-modified version of the database (prior to migration), and restored the site files on beta.domain.com/content and proven to myself that I’m not crazy. The site works fine on the original domain name.

    The key is have_posts() returns FALSE when it should be returning TRUE. I tried to track down more of what have_posts is doing, but was unable to get very far.

    Note: I’m using “domain.com” as an example.

    Anyone have any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No posts after migration to new domain. Restore to original works.’ is closed to new replies.