Clicking “Show More Comments” loads the same visible comments [closed]
Clicking “Show More Comments” loads the same visible comments [closed]
Clicking “Show More Comments” loads the same visible comments [closed]
wp_nonce_field() is intended to echo out the nonce as a hidden field in your form, but above you seem to have it somewhere else. If you want to create a nonce outside of the form HTML you need to be using wp_create_nonce(). By default the API is expecting a nonce key of wp_rest. No idea … Read more
Suggest to reformat the data like such (untested): function load_more_blogs() { … $results = array(); foreach ( $query->posts as $post ) { $results[] = array( ‘post’ => $post, ‘image’ => get_the_post_thumbnail( $post->ID, ‘post-thumbnail’ ), ); } wp_send_json_success( $results ); exit(); } This will give you an array of arrays, with the inner array have two … Read more
I figured it out. I was creating the form when a button was clicked. I had to put the replyform submit within that function. Working now.
Nonce verification problem when logging in after a logout
nonce_user_logged_out to assign guests unique nonces breaks ajax calls
Catch Form value at AJAX Form submit
Removing custom physical folders with rmdir
I think it’s because you’re doing your localization in the shortcode which may be messing with the order of things. Instead do this: add_action( ‘wp_enqueue_scripts’, array( $this, ‘frontend_enqueue’ ) ); function frontend_enqueue() { wp_register_script( ‘my-handle’, plugins_url( ‘js/frontend.js’, __FILE__), array( ‘jquery’ ), ‘1.0.0’, true); wp_localize_script(‘my-handle’, ‘ajax_actions’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) )); } Then… add_shortcode( … Read more
If you look at the source of admin-ajax.php, the answer becomes clearer: $action = $_REQUEST[‘action’]; if ( is_user_logged_in() ) { // If no action is registered, return a Bad Request response. if ( ! has_action( “wp_ajax_{$action}” ) ) { wp_die( ‘0’, 400 ); } /** * Fires authenticated Ajax actions for logged-in users. * * … Read more