1

Craft CMS V2.
Comment Plugin: verbb comment

{% set comments = craft.comments.all({
    limit: 10,
    status: 'approved'
}) %}

{% for comment in comments %}
    {{ comment.comment }}
{% endfor %}

This query fetches all approved comments including flagged (Comment marked as inappropriate) comments because flagged comment status is 'approved'.

But I want to hide flagged comments from approved comments.

1 Answer 1

2

You can use the isFlagged() method to only display non-flagged comments:

{% set comments = craft.comments.all({
    limit: 10,
    status: 'approved'
}) %}

{% for comment in comments if comment.isFlagged() == false %}
    {{ comment.comment }}
{% endfor %}

Your Answer

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

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