简体   繁体   中英

Wordpress wp-comments-post.php

In order to add comment meta data when a new comment is added I modified the wp-comments-post.php file. Now my worry is that when you upgrade wordpress, you will lose it.

So I am looking to find out whether the file is replaced during upgrade, and if so, what is the standard practice to do this?

The modifications I made were:

if(isset($_POST['rating'])){
        $rate = wp_filter_nohtml_kses($_POST['rating']);
        add_comment_meta($comment_id, 'coumment_rating', $rate, false);
    }

Check out the example in the codex,,add that example into your themes functions file with what you did in your mod inside that function...always avoid modifying core wordpress files unless absolutely necessay..and in most cases you can add action hooks similar to the example in this case http://codex.wordpress.org/Function_Reference/add_comment_meta

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM