Help me with my first very basic plugin

I have already answered this question stackoverflow, but adding the answer here as well: Looking on the code it does not seem like the WordPress way of doing this kind of thing. First you need to include your ajax-process.php in the plugins main file e.g: require_once plugin_dir_path(__FILE__) . ‘/ajax-process.php’; Second, you need to register your … Read more

How to submit the custom form data in database in WordPress without plugin?

Finally, I got my solution, I added below code in function.php and using shortcode I am getting my form on webpage function st_contact_form(){ ob_start(); ?> <div class=”contact_form-wrapper popup-contact-form”> <form action=”” method=”post” name=”contact_form” id=”contact_form” autocomplete=”off”> <div class=”row”> <div class=”col-xl-6 col-lg-6 col-md-6 col-sm-12 col-xs-12 “> <div class=”form-group”> <input type=”text” name=”name” placeholder=”Name” class=”form-control” required> </div> </div> <div class=”col-xl-6 … Read more

How to use wordpress with any “site url” (the url in settings) for development?

There’s a bit more than just the option to update unfortunately. I’d recommend reading over https://wordpress.org/support/article/changing-the-site-url/ to learn about what is involved first. As far as plugin solutions, there’s lots that exist already, which would be a safer route than rolling your own. Better Search and Replace is a popular one. Since you’re going to … Read more

Plugin use of ajax/jquery depending dropdown

Does the get-contacts.php script work ok if you load it directly, e.g. in your browser or from the command line, or in some test javascript? Maybe you don’t have the path correct. Instead of providing a partial path you could provide an absolute path. Is the reuse directory in the root of your web space? … Read more

Response from Php File to Ajax is not getting sent

Issue Solved I was missing a closing brace for data… jQuery(document).ready(function($){ $(“#login_otp_btn”).click(function(event){ val(); event.preventDefault(); jQuery.ajax({ url: wpac_ajax_url.ajax_url, type:’POST’, data :{ dataType:’JSON’, action : ‘login_ajax_callback’, login : $(“#login_mobile”).val(), } success:function(response){ console.log(“url wpac ” + wpac_ajax_url.ajax_url); if(response !== “”){ response = JSON.parse( response ); console.log(response); }else{ console.log(“Response is empty”); } }, }); $(“#login_otp_field”).show(); }) });