  Theoretical attempts proposed so far to describe ordinary percolation
processes on real-world networks rely on the locally tree-like ansatz. Such an
approximation, however, holds only to a limited extent, as real graphs are
often characterized by high frequencies of short loops. We present here a
theoretical framework able to overcome such a limitation for the case of site
percolation. Our method is based on a message passing algorithm that discounts
redundant paths along triangles in the graph. We systematically test the
approach on 98 real-world graphs and on synthetic networks. We find excellent
accuracy in the prediction of the whole percolation diagram, with significant
improvement with respect to the prediction obtained under the locally tree-like
approximation. Residual discrepancies between theory and simulations do not
depend on clustering and can be attributed to the presence of loops longer than
three edges. We present also a method to account for clustering in bond
percolation, but the improvement with respect to the method based on the
tree-like approximation is much less apparent.
