I am using appendix package to create appendices but also customize them with etoolbox commands. The TOC page number refers to the correct page of appendices sections but the hyperlink jumps to the wrong place.
\documentclass[11pt,a4paper,oneside]{book}
\usepackage[x11names]{xcolor}
\usepackage{caption}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}
\usepackage{tocloft}
\usepackage{appendix}
% customizing appendices
% renew the tags of figures, tables and equations
\newcounter{appendix}
\AtBeginEnvironment{appendices}{\renewcommand{\thefigure}{\Alph{appendix}.\arabic{figure}.}}
\AtBeginEnvironment{appendices}{\renewcommand{\thetable}{\Alph{appendix}.\arabic{table}.}}
\AtBeginEnvironment{appendices}{\renewcommand{\theequation}{\Alph{appendix}.\arabic{equation}}}
\AtBeginEnvironment{appendices}{\renewcommand{\chaptername}{APPENDIX}}
\AtBeginEnvironment{appendices}{\renewcommand{\thesection}{\arabic{appendix}.\arabic{section}.}}
% Define new way to add appendices to the TOC
\newcommand{\appendixtitle}{}
\newcommand{\appendixtitleFull}{\chaptername\space\Alph{appendix}.\space\appendixtitle}
\AtBeginEnvironment{appendices}{
\preto{\chapter}{
\clearpage
\addtocounter{appendix}{1}
\setcounter{section}{0}
\setcounter{figure}{0}
\setcounter{equation}{0}
\phantomsection \addcontentsline{toc}{chapter}{\appendixtitleFull}
}
}
\newcommand{\sampleEquationFloats}{
\begin{figure}
\includegraphics[]{example-image-a}
\caption{Figure Caption}
\end{figure}
\begin{equation}
E = m c^{2}
\end{equation}
\begin{table}
\caption{Table Caption}
\centering
\begin{tabular}{|c |c|}
\hline
Column & Column
\\
\hline
\end{tabular}
\end{table}
}
\begin{document}
\tableofcontents
\begin{appendices}
\renewcommand{\appendixtitle}{My Title}
\chapter*{\appendixtitleFull}
\sampleEquationFloats
\section{One Section}
\section{Another Section}
\renewcommand{\appendixtitle}{My Title}
\chapter*{\appendixtitleFull}
\sampleEquationFloats
\section{One Section}
\section{Another Section}
\renewcommand{\appendixtitle}{My Title}
\chapter*{\appendixtitleFull}
\sampleEquationFloats
\section{One Section}
\section{Another Section}
\end{appendices}
\end{document}

\theHsectionand\theHsubsectionin my code – Al-Motasem Aldaoudeyeh Jul 07 '19 at 06:55\setcounter{section}{0}in\preto{\chapter}{...}, all links work... – frougon Jul 07 '19 at 07:00\thesectionand the counter 'section' are related to\theHsection– Al-Motasem Aldaoudeyeh Jul 07 '19 at 07:07\addtocounter{appendix}{1}with\refstepcounter{appendix}? – Mico Jul 07 '19 at 09:52