I've registered a custom post type, ensured that 'supports' has 'comments', and comments are allowed on new posts under settings -> discussion.

I do see the check boxes for allow comments and allow trackbacks/pings. If I check 'allow comments', then update/publish post, it automatically gets unchecked.

I have no clue why. The only solution I've found is through a SQL query. I can add an action to run a query after save, but I'd like to know what is the problem.

register_post_type( 'ott_products',
        'labels' => array(
            'name' => __( 'OhTheThings Products' ),
            'singular_name' => __( 'OhTheThings Product' ),
            'add_new' => __( 'Add New' ),
            'add_new_item' => __( 'Add New Product Listing' ),
            'edit' => __( 'Edit' ),
            'edit_item' => __( 'Edit Product Listing' ),
            'new_item' => __( 'New Product Listing' ),
            'view' => __( 'View Product' ),
            'view_item' => __( 'View Product' ),
            'search_items' => __( 'Search Products' ),
            'not_found' => __( 'No product found' ),
            'not_found_in_trash' => __( 'No product found in Trash' ),
            'parent' => __( 'Parent Product' )

        'public' => true, // Can be seen/edited by public.
        'menu_position' => 5, //Position, in this case, just after post.
        'supports' => array( 'comments', 'title', 'editor', 'thumbnail' ),
        'taxonomies' => array( 'category' ),
        'rewrite' => array( 'slug' => 'product' ),

Here's the code for my post type, but I don't really think it's relevant.

EDIT: Code which is making and saving custom fields...

function display_product_info_meta_box($post) { 

        wp_nonce_field( plugin_basename( __FILE__ ), 'ott_checknonce' );  

        $price = get_post_meta($post->ID, 'price', true);  
        $viaTitle = get_post_meta($post->ID, 'viaTitle', true); 
        $viaLink = get_post_meta($post->ID, 'viaLink', true);  
        $learnmore = get_post_meta($post->ID, 'learnmore', true);  
        $description = get_post_meta($post->ID, 'description', true);  
        $userreview = get_post_meta($post->ID, 'userreview', true);   
        $colorscheme = get_post_meta($post->ID, 'colorscheme', true);   

        echo '<table class="form-table">  

                <th><label for="colorscheme">Color Scheme</label></th> 
                    <input type="text" name="colorscheme" id="colorscheme" value="'.$colorscheme.'" size="30" /> 
                    <br /><span class="description">Accepted values: green, red, blue, corresponding to geeky, home life, and oh wow respectively.<br>Default value is green, ie, geeky.</span>

                <th><label for="price">Price (USD)</label></th> 
                    <input type="text" name="price" id="price" value="'.$price.'" size="30" /> 
                    <br /><span class="description">The price, in USD</span>

                <th><label for="viaTitle">Via (Title)</label></th> 
                    <input type="text" name="viaTitle" id="viaTitle" value="'.$viaTitle.'" size="30" /> 
                    <br /><span class="description">Example: \'Amazon\' will output \'Via Amazon\'</span>

                <th><label for="viaLink">Via (Link)</label></th> 
                    <input type="text" name="viaLink" id="viaLink" value="'.$viaLink.'" size="30" /> 
                    <br /><span class="description">The link to go in the \'via\'</span>

                <th><label for="learnmore">Learn More URL</label></th> 
                    <input type="text" name="learnmore" id="learnmore" value="'.$learnmore.'" size="30" /> 
                    <br /><span class="description">The url the \'Learn More\' button should lead to.</span>

                <th><label for="description">Poem/Description</label></th> 
                    <textarea name="description" id="description" cols="60" rows="15">'.$description.'</textarea> 
                    <br /><span class="description">The poem/description. Try and keep it short :)</span>

                <th><label for="userreview">Featured User Review/Product Features</label></th> 
                    <textarea name="userreview" id="userreview" cols="60" rows="15">'.$userreview.'</textarea> 
                    <br /><span class="description">The \'Featured User Review/Product features\' field. Please prepend with \'&lt;h1&gt;Featured User Review&lt;/h1&gt;: \' if it\'s a user review</span>

         </table>'; // end table      

function ottycb_save_postdata($post_id) {
    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 

    if ( !wp_verify_nonce( $_POST['ott_checknonce'], plugin_basename( __FILE__ ) ) )

    update_post_meta($post_id, "price", $_POST["price"]);
    update_post_meta($post_id, "viaTitle", $_POST["viaTitle"]);
    update_post_meta($post_id, "viaLink", $_POST["viaLink"]);
    update_post_meta($post_id, "learnmore", $_POST["learnmore"]);
    update_post_meta($post_id, "description", $_POST["description"]);
    update_post_meta($post_id, "userreview", $_POST["userreview"]);
    update_post_meta($post_id, "colorscheme", $_POST["colorscheme"]);
  • Only thing I can think of is, that there is an additional checkbox field/input parameter of the same name="x" being added to your post form. A plugin is adding a meta box perhaps and trashing/resetting the contents of $_POST. Check if the same issue occurs with all other plugins disabled. Commented Feb 2, 2013 at 16:13
  • I am indeed using custom fields... I'll prefix the names of each and report back. Will also update post with the custom fields code. Which name is most likely to interfere with $_POST? I'm a bit new to this, sorry for newb questions!
    – NamanyayG
    Commented Feb 2, 2013 at 17:10

1 Answer 1


Version depandabiliy - I don't know why but I was using wordpress 3.3.1 and suddenly one day these function stop working I don' know why ? but that's the same thing happens to me - I usually install some common plugins to all my sites - but I never knew if i was plugin fault or update fault - once I upgraded to 3.5.1 these error automatically vanished. Might help us detect if you list your plugins ? do you try deactivating and then checking ? if not the best solution worked for me is upgrade - if you are up to date and using wordpress 3.5.1 and didn't detect any conflicting plugin causing this problem then - try downloading your theme's from your hosting control center and overwrite the current wordpress with the new one or re-install the wordpress. upload your theme and connect your old data base every thing remain same but might help you finishing the problem.

Some time I observed in my career that some things once changed will bug you until you re0install them completely, there are certain coding that over write the orignal wp-files or might be posible a virus or malware over write them - and your hosting authories - scan and removed the malware but the website main core files are still infected or modified causing this problem and you are just puzzled thinking what's wrong with your plugin.

Although this step of re-installing wordpress should consider as the final step if you don't get any legtimate answer to counter the problem. while please Keep us up to date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.