It is the same in the UK , as in Spain. For example if you own a UK house& purchase a holiday home here, legally when you sell it then CGT is payable in the UK. If though you move to spain& purchase , register as a resident , then sell the Uk one then CGT would be payable in Spain. The only difference between UK & Spain is that in spain CGT is payable on the main residence, subject to regional allowances.
The UK tax office stated last month that they were going to investigate ALL house sales over the last 20 years with aview to finding undeclared CGT !
The thread you read over the road was about someone selling there house in the UK now, moving to Spain immediately, which would then make them liable for a tax declaration in Spain next year when they would have to declare the housesale which in turn could leadto the possibility of having to pay CGT here in Spain.
The advice was to ensure that they are not resident in Spain before the 2nd July , day 183 thereby making them not liable to declare next year & the following year they would not be declaring a house sale !