How get get list of pages in ajax search

There is no get_pages() method in the WP_Query class (for WordPress version 4.9.4). So in the data_fetch() function, replace the following: if( $the_query->get_pages() ) : while( $the_query->get_pages() ): $the_query->get_pages(); ?> ..with this: if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> And in the fetch() JS function, set the type to POST, like so: function … Read more

Ajax Check Post Status

So basicly you want an ajax method that checks for post changes. Here’s a great article on WP ajax for front & back-end. In short you want to do the following: Load the Ajax JS script on the pages you want to show the notification popup. Create wp ajax server-side handling, with hook wp_ajax_{your_custom_action}. OR … Read more

Admin-ajax.php 400 error

You have two problems in PHP you need change this is bad: wp_localize_script( ‘customjquery’, ‘ajaxurl’, admin_url( ‘admin- ajax.php’ ) ); change to: wp_localize_script( ‘customjquery’, ‘my_custom_vars’, [‘ajax_url’ => admin_url(‘admin-ajax.php’)] ); and your javascript need this changes is bad: $.ajax({ type: ‘POST’, // use $_POST method to submit data dataType: “html”, url: ajaxurl, change to: $.ajax({ type: … Read more

Ajax WordPress Login needs to be stayed in current page Url without redirecting

Please try following code it will works for you. Please add this in your functions.php for getting current page URL /*Get Current Url */ function currentUrl( $trim_query_string = false ) { $pageURL = (isset( $_SERVER[‘HTTPS’] ) && $_SERVER[‘HTTPS’] == ‘on’) ? “https://” : “http://”; $pageURL .= $_SERVER[“SERVER_NAME”] . $_SERVER[“REQUEST_URI”]; if( ! $trim_query_string ) { return … Read more