Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter joseehilton147

    (@joseehilton147)

    If u dont know how to fix it or isnt possible, how can i set default rate to 1 for every new post? Doing this i think all posts will appear normaly.

    Plugin Support Blaz K.

    (@blazk)

    Hi @joseehilton147,

    how do you retrieve the posts? I think the problem is that posts which have no ratings are not retrieved, probably because they have no meta key for the rating.

    Blaz

    Thread Starter joseehilton147

    (@joseehilton147)

    Yes, i think this is the problem too, but how can i set a default meta for each post? This will surely fix the problem.

    Im using elementor and ive set to filter by highest ratingto low rating and its working, only doesnt show posts without rating, im using localhost so cant send you a link but here’s a pick how its working: https://prnt.sc/ssyk1s

    Thread Starter joseehilton147

    (@joseehilton147)

    Forgot to put a link of database, and yes he only register when a rating is set, there’s a way to set ALL posts to get a meta key? Can be 1 if its possible, this will save my project

    pic: https://prnt.sc/ssyxxn

    Plugin Support Blaz K.

    (@blazk)

    I think it would be better to fix the issue on the other side – by retrieving all posts regardless of the rmp_avg_rating meta key. Nevertheless, you could also try to do it like it’s explained in the topic you shared above.

    So I guess in this case you would do something like this:

    
    function set_default_rating($post_ID){
        add_post_meta($post_ID, 'rmp_vote_count', 1, true);
        add_post_meta($post_ID, 'rmp_rating_val_sum', 5, true);
        add_post_meta($post_ID, 'rmp_avg_rating', 5, true);
    }
    
    add_action('wp_insert_post','set_default_rating');
    

    Now all new posts should have a default rating of 5. Note that I haven’t tested this so test it before deploying.

    Regards,
    Blaz

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Posts with no ratings are excluded. Why?’ is closed to new replies.