WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Database corrupted, maybe, template tags not working, help please? (8 posts)

  1. Branch
    Member
    Posted 6 years ago #

    First, I know this is partially due to my own idiocy. When I upgraded from 2.1 to 2.3, one of my WP installations had (I think) the database corrupted in some way and the template tags such as the_content and the_excerpt stopped working. They no longer fetch the content, which is still in the database. I've seen several other cases of this since, all of which seem to happen after something is done to the database, either an upgrade or the installation of something like eFiction.

    Instead of scrubbing and re-installing from the backup and trying again, I decided it would be ever so much easier just to write a few direct calls to the database into my theme pages. Yes, I know; please don't say it. I was young and stupid then. Unfortunately, perhaps, this workaround worked and I kept it.

    The thing is, after several more upgrades, now at 2.5.1, the template tags still don't work, I have added way too much content to roll back now, and this is starting to cause serious plugin compatibility problems (especially with wordpress-thread-comment, which I would dearly love to use, but which cannot actually post comments with the direct calls to the database worked in).

    Is there any way to rebuild my posts table or something? Or anything else anyone can think of to fix this?

    Things already attempted (and failed): deactivating all plugins; exporting and reimporting database; complete deletion and re-installation of all php files; exporting post content in xml form and importing it into a fresh installation of both php and tables (failed because there were too many files for the import function to handle).

    Help?

    The site in question: http://www.branchandroot.net/archive/

  2. hotkee
    Member
    Posted 6 years ago #

    When you say corrupted, do you mean the data is wrong or the tables are showing as corrupted?

  3. Branch
    Member
    Posted 6 years ago #

    It's a bit of an assumption on my part that they are corrupted in some way. The data is fine, when I can get to it. I just can't get to it with the normal tags, such as the_content.

    I assume it's a db corruption because it seems to only happen, to me and to others I've seen or spoken with, after some manner of database alteration is made, either the alterations of a significant WP update or the installation of similar tables alongside the wp set (that happened to someone else, I'm short on details).

    I don't know how to tell for sure, though. I don't see anything that looks odd when I look at it in PHPMyAdmin, but I don't know that well enough to be sure what I should be looking for. Is there a way I can get some manner of diagnostic from MyAdmin?

  4. hotkee
    Member
    Posted 6 years ago #

    The extra tables wont make any differences unless its for another wordpress installation, in which case bad move, one db per installation or make sure the prefix for tables is not the same for the installations.

    Check if the tables are marked as corrupted in phpmyadmin. Select all the tables, and at the bottom, you should have the drop down and select Repair.

    If that fixes the problem, fine, if not then things like the_content not working could be template issue in which case pase your index.php here

  5. Branch
    Member
    Posted 6 years ago #

    Ah-ha, okay. Tables backed up, tables repaired, and still no working template tags. Argh.

    Will single.php do? I use a static front page, so I don't use index.php at all. I saved single as a text file here. It's the currently working one, so the_content is commented out and the database call currently doing the job is just underneath it.

    Thank you so much for helping steer me through this.

  6. Branch
    Member
    Posted 6 years ago #

    Breakthrough! Maybe.

    I've been fiddling around with variations on the content-fetching commands and this works:

    $mycontent = get_the_content();
    echo $mycontent;

    Now. I know that get_the_content doesn't apply filters, and I think wp_autop is one of those? And I know I've commented the guts out of wp_autop so that I could write or paste html directly into the post writing window. Could this be the problem somehow? I left the actual function wp_autop active, because the system throws fits if I delete the whole thing. Is the filtering process sticking, somehow, because the function doesn't do anything?

    ... I can't really re-enable it at this point, it will completely bollix up my posts, which have, um, slightly random newlines.

    Anyone have any suggestions?

  7. hotkee
    Member
    Posted 6 years ago #

    I am guessing wp_autop is some plugin you are using, never come across it myself. Suggest you disable the plugin and avoid using plugin if possible unless you really need it.

  8. Branch
    Member
    Posted 6 years ago #

    Success!

    No, wp_autop is one of the automatic formatting filters, in formatting.php. It adds a paragraph tag at every newline, which can seriously screw up raw html code.

    But that's okay, because commenting that out was, indeed the problem, but I found a plugin that disables it instead: Disable wpautop.

    It works charmingly with 2.5, and I can use the template tags like the_content and the_excerpt again, and not hack up the core files, and all is delightful.

    Thanks for helping me with the db troubleshooting, hotkee!

Topic Closed

This topic has been closed to new replies.

About this Topic