2

You have not added wp_ajax_nopriv so that is the reason for ajax failure for non-logged in users. public function register() { add_action( 'wp_ajax_tidplus' , array( $this, 'post' ) ); add_action( 'wp_ajax_nopriv_tidplus' , array( $this, 'post' ) ); } Please do this change and check.


2

Keep in mind not everyone is running JavaScript, so you really need a server-side form processor like PHP rather than relying solely on jQuery. Best thing to do on a WordPress site is create a plugin that processes your form. You can include helper libraries like FPDF to not only generate the PDFs but that also have the option to save them to your server ...


2

The problem is that you're not using the correct name for the REST API nonce header — the correct name is X-WP-Nonce, but you used X-WP-Header: fetch('http://localhost/wptest2/?rest_route=/wp/v2/users/me', { method : 'get', mode : 'cors', headers : { 'Access-Control-Allow-Origin' : '*', 'X-WP-Header' : _wpnonce // here you used the wrong ...


2

<?php function enqueue_javascript_for_certain_page() { $page_id = 100; // change this to fit your needs if ( is_page( $page_id ) ) { // check the page you are on wp_enqueue_script( 'my_script_name', // script handle get_template_directory_uri() . '/js/my-js-file.js', // script URI array( // your ...


1

1st variant. CEO should add xyz.org with proper IP to the hosts file on his computer. This will work on the local machine. However, if it is a laptop, and sometimes the same laptop will be used in intranet, you need another solution. 2nd variant. In hosts file, point abc.org to outer IP. On site, install plugin Multiple Domains and setup it to work with ...


1

If you're using classic editor, then add_meta_box() will do the trick. Just make sure you set the context as "side". With Gutenberg I think you'll need a Panel component. I'm not too familiar with Gutenberg so I can't comment more on this.


1

In order to change the shortcode value by leveraging ajax, you need to modify the PHP code and jQuery as mentioned below: function table_generator() { // Set product providers $providers = array( 'Provider 1', 'Provider 2', 'Provider 3', ); // Build provider selection form $output .= '<form id="submitProvider" ...


1

This sounds like a timing issue, there is probably already some JS running after your script is ran. Try wrapping your JS in $(window).load(), this will run the function after other page assets have loaded and should fix the timing issue. For example... $(window).load(function() { document.getElementById('user_pass').focus(); }); Here is some info ...


1

you can use this code or adapted to work for you case,, hope its work.. Add it to your function.php add_filter( 'woocommerce_product_related_posts', 'woocommerce_get_direct_related_products' ); function woocommerce_get_direct_related_products() { global $woocommerce, $product; // Related products are found from category $cats_array = array(0); ...


1

You must have to include wp_head() in header.php and wp_footer(); in your footer.php header.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <?php wp_head(); ?> <body> footer.php <?php wp_footer();?> </body> </html> if ...


Only top voted, non community-wiki answers of a minimum length are eligible