D
D
Dmitry Polyakov2017-12-24 17:24:23
Python
Dmitry Polyakov, 2017-12-24 17:24:23

What are the hooks for the submit event?

Hello. I'm wondering if there are any hooks that fire when submitting a form, except for admin_post and its variants?
If I understand correctly, admin_post only works for site admins?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
gimntut, 2019-10-15
@gimntut

Obviously, the reason for the slowdown is due to the opening and closing of base.txt, deleted.txt and good.txt files for each line from first.txt.
It should be something like this:

f2 = open("base.txt", encoding = 'utf-8')
d = open('deleted.txt', 'a', encoding = 'utf-8')
ffinal = open("good.txt",mode = 'a',encoding = 'utf-8')
f1 = open("first.txt",mode = 'r',encoding = 'utf-8')
for line in f1:
   ...
f1.close()
ffinal.close()
d.close()
f2.close()

D
Dimonchik, 2019-10-15
@dimonchik2013

little code by the
way, for came up with keep learning

A
Alexander Toropov, 2017-12-24
@James_Raynor

You can use AJAX handlers to catch the form submission.
There are hooks for this:
wp_ajax_

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question