Hmm I can’t reproduce the problem on my end. Does it work on the default theme without any other plugins activated? Also are you using any caching plugin?
Hey, if i use the default theme twenty sixteen, it works
i am using WP Rocket
if i deactivate wp-postratings and edit a post/page…. the stars will NOT be deleted
I am pretty certain this is a caching plugin issue or your theme issue. Try deactivating your caching plugin and set WP_CACHE to false in your wp-config.php to see if it works with your current theme.
By right when you deactivated wp-postratings, the stars will not show because if(function_exists('the_ratings')) will return false and the_ratings(); will never be called and hence no stars will be displayed.
If after deactivating wp-postratings will show, it seems to be a caching issue.
the problem is the function add_ratings_fields.
everytime i edit a post/page, this function resets alle ratings because it seems to be publishing the post/page.
do you know why?
there is a bug in your plugin:
add_action('publish_post', 'add_ratings_fields');
add_action('publish_page', 'add_ratings_fields');
we fixed it:
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") {
now it works
Hmmm, we only add the fields on publish and if the ratings field already existed, the fields will not be created. So I am not sure why is it happening on your case. It works fine on my dev site testing.
the problem seems to be that if i edit the post, there will be a delete and den a replublish… so the function resets all ratings.
Hi,
I have the same problem, I tried to place your code to fix it but I got php error.
How did you do exactly ? Which part of the code did you change, reemplace ?
Thanks !