How can I call a php file inside a wordpress plugin

0

How can I create a file inside a wordpress plugin to receive parameters passed via the front post? the file would need to use the wp_db function.

    
asked by anonymous 09.07.2018 / 22:41

1 answer

0

You can use admin_post_ (action).

When you create your form on the front end you add the input

<input type="hidden" name="action" value="nome_da_funcao">

Inside your plugin you add the hooks

add_action( 'admin_post_nome_da_funcao', 'my_function' );
add_action( 'admin_post_nopriv_nome_da_funcao', 'my_function' );


function my_function() {
//Seus codigos e request aqui

}

link link

    
24.07.2018 / 22:37