I am developing a WordPress website where I have to link a button to a function inside the functions.php file. Meaning that when someone clicks on a certain button, this will trigger a call to a specific function.
I have read about various ways to approach this:
By creating a link acting as a button:
<a href="?action=linked_function" class="button btn btn-primary">Click to call function</a>
Or a form submission:
Others suggest using ajax for this case, although I don’t really care if the page has to reload after the function call or if I have to redirect the user to the previous page.
I am wondering though what are the best and most importantly safest options to develop this.
Any suggestions?
Thanks!
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com