SAN FRANCISCO — YouTube will disable comments on most videos that include children 13 and younger after coming under fire for failing to keep pedophiles from posting suggestive remarks on such videos, the company said on Thursday.

YouTube, which is owned by Google, said in a blog post that over the next few months, it would suspend comments on videos of young minors — those 13 and under — and older teenagers that may risk “attracting predatory behavior.”

The move is a response to the latest content-related crisis to confront YouTube: a video documenting how pedophiles have used comments on videos of children to guide other predators. After the video highlighting the practice went viral, several companies whose advertisements had appeared in the videos at issue said they would boycott YouTube.

In general, the videos did not violate YouTube’s standards and showed mostly innocent behavior like young girls doing gymnastics or playing Twister. But the comments posted below the videos became overrun with suggestive remarks directed at the children.