Smooth Scroll not working in table of content

I have installed table of content plus plugin to add table of content in my site. It is working very well, except when title have symbols like “&” and “…”. Check this link for example. https://www.discovernauts.com/en/travel-guides/tours/jamaica-tours/floyds-pelican-bar-treasure-beach/

Here when you click duration & cost, it does not smoothly scroll to the section. It can be fixed if i add id in the title like this “duration-038-cost”. However this is not good for SEO

There might be another way to fix it. Wp filter can be used like shown in this link https://dublue.com/plugins/toc/#For_developers

function my_custom_anchor( $anchor )
{
return strtoupper( $anchor );
}
add_filter( ‘toc_url_anchor_target’, ‘my_custom_anchor’ );

I am really bad at php, and i cannot figure out how can i use wp filter to remove &/038 from anchor links.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.