@HappyArif You just kept a line in your code that needs to be changed if there is a Category selected.
$args = array(
'orderby' => 'date',
'post_type' => 'course',
'posts_per_page' => -1,
'tax_query' => $tax_query,
);
This have 'posts_per_page' => -1 which needs to be changed to 'posts_per_page' => 9, 'paged' => $paged to make the categorized ajax call as Paged query.
if ( ! empty( $groups_terms ) ) {
$paged = 2; //This needs to be the Paged Request Number.
$args = array(
'orderby' => 'date',
'post_type' => 'course',
'posts_per_page' => 9,
'paged' => $paged,
'tax_query' => $tax_query
);
}
else
{
$args = array(
'orderby' => 'date',
'post_type' => 'course',
'posts_per_page' => -1,
);
}
Related Posts:
- AJAX: WordPress filters inside $html do not work as intended
- How can I fetch loop of post titles via AJAX?
- Do I require the use of nonce?
- WordPress Ajax always returns a 404 error
- problem with ajax and the path to the php page
- Security – Ajax and Nonce use [closed]
- Looking for a better way to handle an ajax script that pulls in post data on click
- Targeting single page with JS
- Can’t use get_results() in ajax query
- Problem with WordPress Ajax form
- Click loads template via ajax
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- Access/update database with jQuery
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- Passing jQuery value using Ajax to a page template
- How to set a custom path, for ajax image upload folder in admin?
- ajax_object is not defined when ajax calls the function
- How to speed up admin-ajax.php in wordpress
- Why is this Ajax not working?
- Use ajax from function.php
- Ajax return code 400
- How to test nonce with AJAX – Plugin development
- ajax, right way to do it and make it works?
- WordPress ajax doesn’t display object method on jQuery .change() function
- Ajax loaded form replaces form action with Ajax url
- Ajax category filtering products default show all
- prevent default not stopping page refresh. Passing form information to and from php with ajax in a wordpress site
- Ajax date_query not working past the first iteration
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- AJAX pagination, update current page
- adjust section according to country?
- Change “add to cart” button color based on Woocommerce product category [closed]
- Ajax request returns ‘Array’. How to output the actual results?
- How to add a do_action on refreshing of WP customizer?
- Setting value of session with Ajax not working
- [jQuery]Adding shortcode
- Display parent and child taxonomies in separate drop down select fields
- Fancybox type popup window that’s not an iframe
- WordPress admin-ajax.php 400 bad request
- WordPress Ajax Call inserting data but success response false
- Ajax contact form return 0
- AJAX – Returning Two JSON Objects with One PHP Function
- Unset session variable on page reload / setup but exclude AJAX
- Add Ajax Hooks and Call from Custom Template PHP
- WordPress Ajax Always returning 0
- How to keep track of when a vote is cast?
- Ajax filter button display all posts
- My jQuery Ajax form submit is still refreshing page?
- Ajax search shows all results when user empties input?
- Why i can’t get custom fields value or post ID via Ajax?
- Output votes to div dynamically in wordpress
- Admin-ajax php not working on new wordpress version
- Proper way to use WordPress function with AJAX PHP file
- Live search from database table
- Accessing an API with jQuery and AJAX
- Execute Jquery when a specific page in my plugin is loading
- what does $options = get_option(‘test_theme’); do?
- Search Ajax Call – Use Form Data in Response
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Why does PHP called with Jquery AJAX not allow additional php code to be added?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Database entry removed on browser refresh, Ajax PHP jQuery
- jquery & ajax getting data from php in wordpress . admin-ajax.php returns 400
- How do I call a value from the datase using ajax
- Remove Author Links
- Ajax result show in console if is called outside function and not showing in array
- Where to add my PHP codes for AJAX Jquery to work?
- How to use wp_ajax_set_post_thumbnail?
- Can’t make lazy load for my site, help!
- How to reload a php script, using AJAX and jQuery
- wp_ajax_ 400 Bad Request
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- WordPress Ajax filter: Create two loops for different output styles?
- How to call a function from functions.php with ajax?
- Custom theme admin-ajax.php 400 (Bad Request)
- Remove item from post_meta array via AJAX
- number of posts with “Load More”
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- Ajax not updating to database
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- how use php query in AJAX jquery
- Ajax Load more CPT via shortcode
- Apply filters when loading post via ajax
- Submitting my form to the database and then redirecting to payment site
- Pass the updated value of aid from form using ajax
- ajax form with multiple submit buttons and values
- 500 (Internal Server Error) of external php file
- Use jQuery and AJAX to get HTML
- Dynamic Gallery
- best way to communicate between php and jquery/javascript
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Fatal error: Uncaught Error: Call to undefined function wp_nav_menu()
- ajax form function error
- Load Meta box value into div AJAX [duplicate]
- Help with AJAX request
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)