Hot answers tagged

1

I figured it out. Instead of trying to combine the two functions together in my functions.php file, I added both of them. Why did this work? Because one is adding a new comment (via a call to ajax-comments.php) and the other function is querying all the existing comments. So it's something like this: My original html5blankcomments() function grabbed the ...


1

Something v basic might look like this var ppp = 9; var loaded = ppp; var maxPosts = 50; postData.append( 'action', 'loadmore' ); postData.append( 'paged', section_posts ); postData.append( 'posts_per_page', ppp ); if ( loaded < maxPosts ) { // check if we're below the max post number const xhr = new XMLHttpRequest(); xhr.open( 'POST', ajaxurl );...


1

Not really a WordPress related question but you could do this // creates a object from the array, one of the properies (search) contains the query let url = new URL('https://dev/job/?job_id=jkdbsbd45JubJKAAASSYT'); // will create a object of all availalble query properites const urlSearchParams = new URLSearchParams(url.search); const params = Object....


1

If anyone still needs it: wp_add_inline_script( 'map-scripts', 'const ajax_info = ' . json_encode(array( 'ajaxurl' => admin_url('admin-ajax.php'), )), 'before' ); but, it's good practice to use nonce as well for better security: wp_add_inline_script( 'map-scripts', 'const ajax_info = ' . json_encode(array( 'ajaxurl' => ...


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