WordPress.org

Ready to get started?Download WordPress

Forums

custom post types - uneditable in dashboard (5 posts)

  1. hafman
    Member
    Posted 2 years ago #

    Hello,
    I made a custom post type back when WordPress version 3.1 was the latest. Unfortunately i used camel case for both the post type and the taxonomy.

    In recent versions it seems that camel casing these words is not supported so i am stuck with 397 posts that can't be edited in the back or seen at the front end.

    What are my options apart from copying over all the data into a new post type that follows the rules?

    I looked at the database but i'm not sure i want to get into that!

  2. hafman
    Member
    Posted 2 years ago #

    Actually i can't copy anything over as the editing is locked and the content is not viewable, Doh! No choice but to fiddle with the database...... hmmm....

  3. Michael Dance
    Member
    Posted 2 years ago #

    First, change the name of the custom post type in your register_post_type function.

    Then, the easiest thing to do is run a database query directly, inside phpMyAdmin or whatever. If your database prefix was wp_, it would look like this:

    UPDATE wp_posts SET post_type = 'new_post_type_name' WHERE post_type = 'oldPostTypeName';

    Back up your database before doing this!

  4. hafman
    Member
    Posted 2 years ago #

    I just found this link to stack exchange and tried it, adding a function to functions.php that has successfully renamed the post type. All the links have come back on in the admin. Still nothing out front though.

  5. hafman
    Member
    Posted 2 years ago #

    Here is the code i used and i'm trying adapt it to access the wp_term_taxonony table.

    if(!get_option('custom_type_updated')){
    global $wpdb;
    $wpdb->query("UPDATE $wpdb->wp_term_taxonomy SET taxonomy = 'imggallery' WHERE taxonomy = 'imgGallery'");
    update_option('custom_type_updated','true');
    }

    Nothing doing yet that i can see in the database

Topic Closed

This topic has been closed to new replies.

About this Topic