Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Pits on "the_post calls my function twice instead of once"

$
0
0

Hi there

I'm saving input from a form out of a page, using "the_post" hook. The function is triggered by a variable in $_POST which is a filled checkbox in the form.

`function my_function(){
global $wpdb;
if ($_POST[checkbox_SOMECHECKBOX]){
do some things;
}
add_action('the_post', 'my_function');

While everything works, the function is called twice, rendering two times the action. I don't get it why. Would love to use that hook, as it allowes me to echo into the beginning of the page/post I'm loading as a response to the submitting of the form.
TIA for help


Viewing all articles
Browse latest Browse all 8245

Trending Articles