Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter itslars

    (@itslars)

    Dear Lester,

    i’ve tested it on a fresh install already. It works perfectly.

    I think you are totally right if you say it is a custom field error.
    Our theme use a lot of custom fields.

    But I have to ask you:
    Could you please add this Fix to the next release, or a fix like that? I mean the fix works great and improve your code for all users, who using a theme with custom fields. Is it perhaps possible?

    The fixed Code look like this:

    ### Function: Add Rating Custom Fields
    add_action('transition_post_status', 'add_ratings_fields', 10, 4);
    function add_ratings_fields($new_status, $old_status, $post) {
            global $wpdb;
            $post_ID = $post->ID;
            if($new_status == "publish" && $old_status != "publish") {
    		add_post_meta($post_ID, 'ratings_users', 0, true);
    		add_post_meta($post_ID, 'ratings_score', 0, true);
    		add_post_meta($post_ID, 'ratings_average', 0, true);
    	}
    }

    It would be GREAT!!!

    Best regards,
    Lars

Viewing 1 replies (of 1 total)