Despite the reliable protection of sites, they are still hacked. Moreover, cybercriminals are not always aimed at getting the creator's money - sometimes they just need to place malicious code. Most often, porn is placed, since it is it that allows you to get the most money illegally.
First of all, you need to analyze the state of your resource. If the unnecessary fragment was inserted organically, then, most likely, the hacker worked on his own. If the page has seriously changed after unnecessary changes, then, most likely, an automatic program was working that used the shortcomings of your CMS.
Manual hacking
In the first case, you need to carefully study the site code. Look where the porn is and try to find that particular piece of code. Then you need to use the original template and compare the changes. If you did not save the source, then the task becomes more difficult, since hackers often carefully mask such inserts.
If the code cannot be found, then contact the hosting. As a rule, good server vendors keep all the changes that the user makes. You will be able to see when the hacker was hacked and which files the hacker changed. If you cannot determine these reasons yourself, contact the hosting technical support. In most cases, they help users solve such troubles.
After the unnecessary code is found, it must be removed. Sometimes hackers use different encryption methods, adding important site functions to their own encoding. Thus, by removing unnecessary code, you automatically remove the lines necessary for the resource to work. In this case, you need to use a decryptor. Enter the sample code in Yandex and define the encryption method. The decryptor in this case is not difficult to find.
Other methods
If the site has been subjected to automatic attacks, then you need to contact the official CMS developer as soon as possible. Most likely, they have already found this bug and released an update that fixes it. Download it and install it on your website.
Sometimes the porn on the site appears not because of hacking, but because of ad codes. Many affiliate programs (especially teasers) offer users posting materials of various categories. Sometimes such systems fail and the wrong category is placed instead of the required advertising materials. In this case, it is enough just to remove the code and write to the technical support of the affiliate program.
If none of these methods suits you, then you can contact a specialist. They can be easily found on various freelance sites. For a fee, an experienced webmaster will find and fix the problem, as well as give recommendations on how to avoid them in the future.