Prevent empty a tags being converted
-
Using HTML Import 2.5 –
I’m importing RoboHelp files into WP. The pages have plenty of tags with the structure
<a id="foo" name="foo"></a>to set up internal bookmarks.When I import the pages with HTML Import, these empty tags are converted to self-closing, such as
<a id="foo" name="foo" />This leads to the page being rendered like all of the text on it is in an
<a>tag, hence it’s blue and the cursor turns to a pointer.However, when I switch from the text editor to the visual editor, it fixes the problem, closing all empty tags to the original format. The page renders correctly.
Is there a way turn off in HTML Import whatever is converting those empty tags into self-closing to begin with? I tried importing with the Clean up bad ( Word, Frontpage ) HTML option both on and off – no difference. Anyway, I definitely need it on for other issues with the pages.
I also tried commenting out line 227
$string = preg_replace( "/<[^\/>]*>( [\s]? )*<\/[^>]*>/", ' ', $string );to get it to ignore empty tags, but there was no effect. I need to keep those empty tags anyway.
Thanks for your help and for the incredibly useful plugin!
The topic ‘Prevent empty a tags being converted’ is closed to new replies.