WordPress ajax not working in registration

Move this action ‘ add_action( ‘wp_ajax_nopriv_add_to_register’, ‘to_register’ );’ from load_scripts function(). // Load scripts function load_scripts() { // I called jquery.min.js and jquery validation from function.php, not from here wp_enqueue_script(‘test-reg’, get_template_directory_uri() . ‘/js/my-test-reg.js’, array(‘jquery’), ‘1.0’, true ); wp_localize_script( ‘test-reg’, ‘myAjax’, array( ‘myUrl’ => admin_url(‘admin-ajax.php’) ) ); } add_action( ‘wp_ajax_nopriv_add_to_register’, ‘to_register’ ); Replace reg_form() function with … Read more

Can I access WordPress API’s from within plugin scripts?

I believe you’re using ajax refering the process_form.php. However the right way to access any ajax is through the wp-admin/admin-ajax.php. Pull all your code from process_form.php to a function (can be added on your main plugin file): function my_process_form() { //…code from process_form.php if ( ! $error ) { //your error boolean return wp_json_success(); //recommend … Read more

Export Posts with specific custom fields by sql

Hi The tables that you need to consider is wp_posts – Which contains all the details about the posts. wp_postmeta – Which is used to store the meta details for a post with relation to post_id. Query will be Select * FROM wp_posts a, wp_postmeta b WHERE a.post_status=”published” AND a.post_id = b.post_id AND b.meta_key = … Read more