WordPress Plugin #49 - How to use the WordPress Ajax Nonce

preview_player
Показать описание
:: Support Me ::

:: Join the Forum ::

:: Tutorial Series ::

:: My Website ::

:: Follow me on ::
Рекомендации по теме
Комментарии
Автор

Thanks for the tutorial! There is some little thing with check_ajax_referer function. You should provide a 3rd parameter set to 'false' because otherwise if the nonce is incorrect the whole script will be terminated ie. method "$this->returnJson('error');" will never be reached and the wordpress will return in that case an error status '-1'.

So it should look like this: check_ajax_referer('testimonial-nonce', 'nonce', false)

Cheers!

acerrusm
Автор

thanks man, will u complete this series to the end ?

homamhomam
Автор

Hmmm, i dont get it. How this form will work if you dont send <input type="hidden" name="action" value="submit_testimonial"> data to the server with fetch?

mathewi
Автор

Can you make a project based plugin development tutorial? I think that would be more interesting

nasiruddin
Автор

hey can we use angular.js with wordpress.

aaravsweb
Автор

What if I want after form submission it goes to another page either containing another in different form or a page showing a report from the database related to the first form.

TimothyCareyDV
Автор

Please prepare tutorial how to fill PDF something else data ?

pawel-fzpt
Автор

I create a automated version of your collect data and validate functions. I still haven't figured out how to correct the problem when you hit the enter key to go to a new line in the textarea that you have in there before my changes.

Calls in the listener:
var theData = collectAllDataTestimonial();
//Validate All
if(validateEverythingTestimonial(theData, theForm)== 0) {return;}

THE TWO NEW FUNCTIONS:
function collectAllDataTestimonial() {// collect all the data
var data =
console.log(data[0].value);
return data;
}
function validateEverythingTestimonial(data, form){
// validate everything
for (var i = 0; i < data.length; i++) {
//console.log(i +' : '+data[i].name+': '+data[i].value);
if(data[i].name == 'email' && data[i].value){
//console.log(data[i].name+' : '+data[i].value)
if (! validateEmail(data[i].value)) {


return 0;
}
}
if (! data[i].value) {

return 0;
}
}
return 1;
}

TimothyCareyDV