I have added some custom ajax calls and functionality on my WordPress site. I added code in function.php which is placed in wp_includes folder. It was working fine but from the last 2 weeks, my custom functions automatically removed from functions.php file.
what is the solution of this? I am new to WordPress. Any help would be highly appreciable.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The simplest advice is that you should never edit what are generally know as Core WordPress files, that includes adding new files within the wp-includes and wp-admin directories.
The simple reason why this is not a good idea is that they are replaced when WordPres updates – deleting any changes or additional files – which I presume is the reason your files were also removed recently.
Instead, you should add changes to your own theme or a custom plugin – the theme is the easiest route in most cases, but again you should avoid to edit things you don’t control, so don’t edit a theme you have bought or downloaded, instead learn how to create a child theme which you can safely edit, knowing that your updates will not get lost.
Once you have your child theme – or custom plugin – you can add your code there – in a theme the easiest place is inside the functions.php file
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0