The priest is correct. A Catholic must submit his mind and will to the teachings of the Church even when not speaking ex cathedra (e.g., truths contained in the Catechism, and that artificial contraception is sinful).
Lumen Gentium 25.
*Can. 750 §1. A person must believe with divine and Catholic faith all those things contained in the word of God, written or handed on, that is, in the one deposit of faith entrusted to the Church, and at the same time proposed as divinely revealed either by the solemn magisterium of the Church or by its ordinary and universal magisterium which is manifested by the common adherence of the Christian faithful under the leadership of the sacred magisterium; therefore all are bound to avoid any doctrines whatsoever contrary to them.
§2. Each and every thing which is proposed definitively by the magisterium of the Church concerning the doctrine of faith and morals, that is, each and every thing which is required to safeguard reverently and to expound faithfully the same deposit of faith, is also to be firmly embraced and retained; therefore, one who rejects those propositions which are to be held definitively is opposed to the doctrine of the Catholic Church.*
If a Catholic willfully and knowingly withdraws his assent from the Catholic faith, he is sinning against the grace God has given him and thus is not innocently ignorant. To receive the Eucharist in the state of mortal sin is a sacrilege. However, if a Catholic was never truly catechized and who had seen no evidence or insufficient evidence for the truths of the Church, his “unintentional ignorance inadvertence, duress, fear, habit, inordinate attachments, and other psychological or social factors can diminish or even remove the imputability of a grave offense”(CCC 1735, 1860).
However, when God reveals truth to a person (e.g. artificial contraception is wrong), he is called to submit to the authority of the Church on that issue and to ask God for the graces necessary to persevere in faith.
Vatican I taught: “God both excites the erring by his grace and aids them so that they can come to a knowledge of the truth, and also confirms in his grace those who he has called out of darkness into his marvelous light, so that they may persevere in this same light, not deserting if he be not deserted (*De fide catholica * 3).
“Before the judgement seat of God each man must render an account of his own life, whether he has done good or evil.”
Gaudium et spes
Recommended reading:
Catechism 1776-1802
Who can receive Holy Communion?