How to call a PHP function in WordPress when you click on a button?
How to process the textarea
field with the standard WordPress function wpautop()
when clicking the button
?
Here's the form:
textarea id="my_ta"Lorem ipsum!/textarea
button id="button_processing_ta"Обработать/button
Here's the handler (to function.php):
?php
function my_action_javascript() { ?
script
document.getElementById( 'button_processing_ta' ).addEventListener( 'click', function() {
let my_ta = document.getElementById( 'my_ta' );
// ???
wpautop( my_ta.value );
});
/script
?php }
add_action( 'admin_print_footer_scripts', 'my_action_javascript', 99 );
?
Sorry for my English...